Skip to content

Instantly share code, notes, and snippets.

@jparishy
jparishy / doc.md
Last active May 1, 2024 21:35
Snapchat Example API Doc

Snapchat API

Base URL

https://snapchat-example-api.herokuapp.com/api/v1/

Notes

  • All endpoints accept JSON payloads for parameters
    • Must include "Content-Type" HTTP header with value "application/json"
    • All endpoints accept /users/authenticate require the X-Api-Token HTTP header
@bradp
bradp / setup.sh
Last active May 1, 2024 21:34
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@brayevalerien
brayevalerien / monokai.md
Last active May 1, 2024 21:30
Monokai theme color codes

Monokai theme color codes

Intro

This document lists the colors used in the Monokai Pro theme with the Classic filter. Please check the Monokai Pro website for more informations.

Colors

Monokai Pro with Classic filter colors:

Preview Hexadecimal RGB
Activity Bar Background activity bar background preview #272822 (39, 40, 34)
Activity Bar Foreground activity bar foreground preview #f8f8f2 (248, 248, 242)
@kerard
kerard / test-dc-ports.ps1
Created March 28, 2022 17:29
domain controller ports test
$ports = "135","389","636","3268","53","88","445","3269"
$dcs = Get-ADDomainController -Filter *
ForEach($dc in $dcs)
{
Foreach ($p in $ports)
{
$_test = Test-NetConnection $dc.Hostname -Port $p -WarningAction SilentlyContinue
If ($_test.tcpTestSucceeded -eq $true)
@drmalex07
drmalex07 / convertUuidToBigInteger.java
Last active May 1, 2024 21:29
Convert a UUID to an unsigned BigInteger #java #UUID #BigInteger
public static final BigInteger B = BigInteger.ONE.shiftLeft(64); // 2^64
public static final BigInteger L = BigInteger.valueOf(Long.MAX_VALUE);
public static BigInteger convertToBigInteger(UUID id)
{
BigInteger lo = BigInteger.valueOf(id.getLeastSignificantBits());
BigInteger hi = BigInteger.valueOf(id.getMostSignificantBits());
// If any of lo/hi parts is negative interpret as unsigned
@jasoncodes
jasoncodes / README
Last active May 1, 2024 21:29
Remote Chrome browser for Capybara
On the shared machine:
Download http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.33.0.jar&can=2&q=
$ brew install chromedriver
$ java -jar selenium-server-standalone-2.33.0.jar
On the local machine:
Set `CHROME_HOSTNAME` in your `.env`, `.rbenv_vars`, or per run.
@james-roden
james-roden / Rotation_Matrix_Function.py
Created February 22, 2018 09:22
Python function to rotate a (x, y) coordinate by a specified angle
# Rotation matrix function
def rotate_matrix (x, y, angle, x_shift=0, y_shift=0, units="DEGREES"):
"""
Rotates a point in the xy-plane counterclockwise through an angle about the origin
https://en.wikipedia.org/wiki/Rotation_matrix
:param x: x coordinate
:param y: y coordinate
:param x_shift: x-axis shift from origin (0, 0)
:param y_shift: y-axis shift from origin (0, 0)
:param angle: The rotation angle in degrees
@LyleScott
LyleScott / rotate_2d_point.py
Last active May 1, 2024 21:26
Rotate X,Y (2D) coordinates around a point or origin in Python
"""
Lyle Scott, III // lyle@ls3.io
Multiple ways to rotate a 2D point around the origin / a point.
Timer benchmark results @ https://gist.github.com/LyleScott/d17e9d314fbe6fc29767d8c5c029c362
"""
from __future__ import print_function
import math
@andrelop
andrelop / gist:941be7f182c11a4a3204f6a9031258a2
Last active May 1, 2024 21:26
Example backup script for Mastodon, WriteFreely and Miniflux
#!/bin/bash
TODAY=$(date +%Y%m%d)
YESTERDAY=$(date --date '1 day ago' +%Y%m%d)
# Backup Mastodon database
docker exec -it $(docker ps | grep mastodon_postgresql | awk '{print $1}') bash -c 'rm -rf /var/lib/postgresql/data/'${YESTERDAY}' || true'
docker exec -it $(docker ps | grep mastodon_postgresql | awk '{print $1}') bash -c 'mkdir /var/lib/postgresql/data/'${TODAY}' || true'
docker exec -it $(docker ps | grep mastodon_postgresql | awk '{print $1}') bash -c 'pg_dumpall -c -U mastodon > /var/lib/postgresql/data/'${TODAY}'/mastodon-dump.sql'
@lcsouzamenezes
lcsouzamenezes / MakerUNOSIM7600.ino
Created May 1, 2024 21:23 — forked from IdrisCytron/MakerUNOSIM7600.ino
Send and receive SMS using SIM7600 GSM module and Arduino.
/*
Project: Interfacing SIM7600 GSM Module with Maker UNO
Item used:
- Maker UNO https://www.cytron.io/p-maker-uno
- SIM7600 https://www.cytron.io/p-4g-3g-2g-gsm-gprs-gnss-hat-for-raspberry-pi
*/
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"