Skip to content

Instantly share code, notes, and snippets.

@sshadmand
sshadmand / In Terminal
Last active June 30, 2022 11:47
When Public WiFi (like Airport) wont re-prompt for login
//
// Based on answer from Gareth here: https://apple.stackexchange.com/questions/88396/forcing-the-wifi-password-entry-dialogue-to-display
//
#> ifconfig
// this will give you a list of MAC addresses
// or
#> sudo ifconfig en0
// will give you a specific MAC address (you will be prompted for your system's admin password
@sshadmand
sshadmand / Adding tmux
Last active May 4, 2022 19:44 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
Create a tmux conf file
#> touch ~/.tmux.conf
Install TMP
#> git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
[Copy and paste tmux.conf below into local file.]
Load tmux configurations
#> tmux source-file ~/.tmux.conf
@sshadmand
sshadmand / build.sh
Created December 25, 2014 20:44
Check git diff before deploying
commit(){
echo "Please enter a commit message..."
read msg
git add . --all
git commit -am $msg
}
check_commit(){
echo ========== CHECKING FOR CHANGES ========
changes=$(git diff)
@sshadmand
sshadmand / FB JS Auth
Last active August 19, 2021 07:23
Facebook JS Auth for Chrome iOS workaround
var ABSOLUTE_URI = "http://yourpage.com/openerhandler.html";
var FB_ID = "123456778";
function openFBLoginDialogManually(){
// Open your auth window containing FB auth page
// with forward URL to your Opened Window handler page (below)
var redirect_uri = "&redirect_uri=" + ABSOLUTE_URI + "fbjscomplete";
var scope = "&scope=public_profile,email,user_friends";
var url = "https://www.facebook.com/dialog/oauth?client_id=" + FB_ID + redirect_uri + scope;
@sshadmand
sshadmand / fb_messenger_webhook.py
Last active January 7, 2019 04:11
FB Messenger Webhook Ported to Python
import json
import requests
from django.views.decorators.csrf import csrf_exempt
FB_MESSENGER_ACCESS_TOKEN = "[TOKEN]"
def respond_FB(sender_id, text):
json_data = {
"recipient": {"id": sender_id},
@sshadmand
sshadmand / Breech_Checker.js
Last active September 29, 2018 07:05
Check Passwords Against BreechList Fast
import sha1 from "sha1";
import axios from "axios";
const BREECH_TOLERENCE = 100;
isBreeched = password => {
const pwSha1 = sha1(password).toUpperCase();
const salt = pwSha1.slice(0, 5);
const pepper = pwSha1.slice(5);
return axios
.get(`https://api.pwnedpasswords.com/range/${salt}`)
@sshadmand
sshadmand / Basic script
Created July 21, 2017 16:01
Pitchbook API with JS and JQuery
const BASE_URL = "https://api.pitchbook.com"
const TOKEN = "TOKEN HERE"
$.ajaxSetup({
headers: { 'authorization': TOKEN }
});
const generalSearch = function(name) {
var def = jQuery.Deferred();
@sshadmand
sshadmand / .bash_profile
Last active June 28, 2017 06:22
A great Bash profile
# always list date and size info
alias ll='ls -all'
# make sure you are on a protected branch and prome remote and local where no remote exists
alias gitclean='git checkout development; git branch | egrep -v "master|development" | xargs git branch -D'
# list all branch and remote branches
alias gitlist='git branch -a'
# This works becuase tagless images look like this:
#
# REPOSITORY TAG IMAGE ID CREATED SIZE
# <none> <none> 39c3774dd2fb 10 minutes ago 417 MB
docker rmi $(docker images -a | grep none)
@sshadmand
sshadmand / filter_tree.js
Last active October 15, 2016 01:50
Recursive Filter on Tree Dict (JSON)
outline = [{
id: 1,
children: [{
id: 3,
label: 'goodbye',
children: []
}],
label: 'hello'
},
{