Skip to content

Instantly share code, notes, and snippets.

@thomseddon
thomseddon / auto-friends-except-acquaintances.js
Created Jul 24, 2018
Automatically change privay to friends except acquaintances (run in console on https://www.facebook.com/me/allactivity)
View auto-friends-except-acquaintances.js
var confirm1 = () => { document.querySelectorAll('.uiLayer:not(.hidden_elem) .uiContextualLayer li')[3].click(); }
var confirm2 = () => { document.querySelectorAll('.uiLayer:not(.hidden_elem) .layerConfirm')[0].click() }
document.querySelectorAll('a[data-tooltip-content="Your friends"]').forEach(function (e, i) { setTimeout(() => { e.click(); setTimeout(confirm1, 1000); setTimeout(confirm2, 2000); }, 3000 * i); })
@thomseddon
thomseddon / mksalt.py
Created Feb 21, 2018
crypt mksalt for python 2
View mksalt.py
import string as _string
from random import SystemRandom as _SystemRandom
_saltchars = _string.ascii_letters + _string.digits + './'
_sr = _SystemRandom()
# SHA512 mksalt extracted from https://github.com/python/cpython/blob/master/Lib/crypt.py
def mksalt():
return '$6$' + ''.join(_sr.choice(_saltchars) for char in range(16))
@thomseddon
thomseddon / adem
Last active Oct 21, 2020
Anydump for ubnt edgemax
View adem
#!/bin/sh
#===================================================================================
#
# FILE: dump.sh
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
# OPTIONS: same as tcpdump
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
# BUGS: ---
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
View ad.sh
#!/bin/sh
#===================================================================================
#
# FILE: dump.sh
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
# OPTIONS: same as tcpdump
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
# BUGS: ---
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
View test.js
# Test:
$ curl http://127.0.0.1:3000
# With debug set to true
$ node test.js
OAuth2Error: The access token was not found
at OAuth2Error (/home/thom/Dev/node/t/node_modules/oauth2-server/lib/error.js:30:12)
at Authorise.getBearerToken (/home/thom/Dev/node/t/node_modules/oauth2-server/lib/authorise.js:70:17)
at run (/home/thom/Dev/node/t/node_modules/oauth2-server/lib/runner.js:15:14)
at runner (/home/thom/Dev/node/t/node_modules/oauth2-server/lib/runner.js:19:5)
@thomseddon
thomseddon / proxy
Created Feb 25, 2015
Create proxies in iptables
View proxy
#!/bin/bash
#
# Copyright Thom Seddon 2015
# MIT
#
if [ "$1" == "" ] || [ "$1" == "help" ]; then
echo "Usage: ~/.proxy <option>"
echo
echo " Options: "
@thomseddon
thomseddon / gist:f58d57b85ce4c1a570b4
Created Jan 20, 2015
Recursively convert tabs to 2 spaces
View gist:f58d57b85ce4c1a570b4
find . -name '*' ! -type d -exec bash -c 'expand -t 2 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
View keybase.md

Keybase proof

I hereby claim:

  • I am thomseddon on github.
  • I am thomseddon (https://keybase.io/thomseddon) on keybase.
  • I have a public key whose fingerprint is F5A5 8053 B6B2 9FE9 C90D 4459 A531 B220 A925 2B68

To claim this, I am signing this object:

@thomseddon
thomseddon / forward.js
Created Sep 15, 2014
SupportBee <3 PagerDuty
View forward.js
function doPost(req) {
var date = new Date();
var hour = date.getHours();
var day = date.getDay();
// Normal support
if (hour >= 9 && hour <= 17 && day >= 1 && day <= 5)
return ContentService.createTextOutput('Normal support');
// Parse body
@thomseddon
thomseddon / bootstrap_cake_pagination.php
Last active Nov 6, 2020
Bootstrap style CakePHP pagination
View bootstrap_cake_pagination.php
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
));
?>
</p>
<ul class="pagination">
<?php
echo $this->Paginator->prev('&laquo;', array('tag' => 'li', 'escape' => false), '<a href="#">&laquo;</a>', array('class' => 'prev disabled', 'tag' => 'li', 'escape' => false));