Skip to content

Instantly share code, notes, and snippets.

@thomseddon
thomseddon / auto-friends-except-acquaintances.js
Created July 24, 2018 09:46
Automatically change privay to friends except acquaintances (run in console on https://www.facebook.com/me/allactivity)
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 February 21, 2018 13:51
crypt mksalt for python 2
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 October 21, 2020 08:51
Anydump for ubnt edgemax
#!/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.
#!/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.
# 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 February 25, 2015 20:31
Create proxies in iptables
#!/bin/bash
#
# Copyright Thom Seddon 2015
# MIT
#
if [ "$1" == "" ] || [ "$1" == "help" ]; then
echo "Usage: ~/.proxy <option>"
echo
echo " Options: "
@thomseddon
thomseddon / gist:f58d57b85ce4c1a570b4
Created January 20, 2015 14:30
Recursively convert tabs to 2 spaces
find . -name '*' ! -type d -exec bash -c 'expand -t 2 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;

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 September 15, 2014 18:23
SupportBee <3 PagerDuty
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 November 6, 2020 11:08
Bootstrap style CakePHP pagination
<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));