Skip to content

Instantly share code, notes, and snippets.

View dvdsmpsn's full-sized avatar

David Simpson dvdsmpsn

View GitHub Profile
@dvdsmpsn
dvdsmpsn / index.html
Created February 24, 2016 14:44 — forked from DeBraid/index.html
Using Chrome DevTools to scrape HTML table and convert to JSON.
// ****************************************************
// USING JQUERY TO CONVERT HTML TABLE INTO JSON
// by Derek from www.cacheflow.ca
// Watch the video: http://youtu.be/DPOOIOU0zVA
// ****************************************************
// Step 1: Create keys for JSON object
var cols = $("#tableID thead tr th").map(function(){
@dvdsmpsn
dvdsmpsn / speedtest-ifttt.sh
Last active March 22, 2018 17:49 — forked from aallan/speedtest-ifttt.sh
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
@dvdsmpsn
dvdsmpsn / speedtest.md
Last active January 25, 2016 00:58
Private Internet Access Speeds - 25 January 2016 01:00

Internet bandwidths at various VPN locations were tested using the speedtest.net tool.

Results are displayed inline below:

Virgin Media, UK / No VPN

This is the baseline measurement. Connected directly to my ISP with no VPN.

PIA VPN

#!/bin/bash
checkExisting(){
echo "Checking if already existing device on file..."
while read fileLine; do
if [ "$line" = "$fileLine" ]; then
echo "[WARNING] Device already initialized on this system. Nothing to do here"
@dvdsmpsn
dvdsmpsn / README.md
Created November 14, 2015 20:14 — forked from teffalump/README.md
OpenWRT adblock implementation

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

Setup

The script must be copied to an OpenWRT router (gargoyle firmware works fine, too).

For example, if the router is located at 192.168.1.1:

@dvdsmpsn
dvdsmpsn / user-macro-jon-lake.vm
Last active October 29, 2015 15:31
I would like to have a macro that opens external pages in a popup or dynamic window, sized or sizing itself to the external content/page. I want links that ‘popup’ to show it within an 800x600 box. Have you any suggestions? Many thanks, Jon Lake
## Macro title: Open links in new window
## Macro key: open-links-in-new-window
## Macro has a body: N
## Body processing: n/a
## Output: HTML
##
## Developed by: David Simpson
## Date created: 2015-10-29
## Installed by: Jonathan Lake
@dvdsmpsn
dvdsmpsn / gist:8fe03cc10ec8d04da931
Created October 29, 2015 11:59
I would like to have a macro that opens external pages in a popup or dynamic window, sized or sizing itself to the external content/page. I want links that ‘popup’ to show it within an 800x600 box. Have you any suggestions? Many thanks, Jon Lake
## Macro title: Open links in new window
## Macro key: open-links-in-new-window
## Macro has a body: N
## Body processing: n/a
## Output: HTML
##
## Developed by: David Simpson
## Date created: 2012-08-26
## Installed by: David Simpson
$ lsof -i :1990
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 358 david 67u IPv4 0xcfffe9cbebae7c8f 0t0 TCP localhost:60864->localhost:stun-p1 (ESTABLISHED)
Google 358 david 84u IPv4 0xcfffe9cbecab2477 0t0 TCP localhost:60807->localhost:stun-p1 (ESTABLISHED)
Google 358 david 87u IPv4 0xcfffe9cbeca72c8f 0t0 TCP localhost:60810->localhost:stun-p1 (ESTABLISHED)
Google 358 david 122u IPv4 0xcfffe9cbedcc9477 0t0 TCP localhost:60757->localhost:stun-p1 (ESTABLISHED)
Google 358 david 157u IPv4 0xcfffe9cbe3550c8f 0t0 TCP localhost:60777->localhost:stun-p1 (ESTABLISHED)
Google 358 david 176u IPv6 0xcfffe9cbe68cb16f 0t0 TCP localhost:61275->localhost:stun-p1 (ESTABLISHED)
Google 358 david 201u IPv4 0xcfffe9cbeca73477 0t0 TCP localhost:60758->localhost:stun-p1 (ESTABLISHED)
java 9228 david 168u IPv6 0xcfffe9cbe3a208ef 0t0 TCP *:stun-p1 (LISTEN)
@dvdsmpsn
dvdsmpsn / jquery.scrollupformenu.js
Created July 21, 2015 23:14
Scroll Up For Menu with fadeIn/FadeOut instead
/**
* Project: Scroll Up For Menu
* Description: A simple mobile optimised menuing system which gets out of the way when you're not using it.
* Author: David Simpson <[email protected]>
* License: Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>
* Source: http://github.com/dvdsmpsn/scroll-up-for-menu
*
* Usage: $('#top').scrollUpForMenu(options);
*
*
@dvdsmpsn
dvdsmpsn / global.vmd
Last active August 29, 2015 14:24
Changing the dashboard in Confluence
## ********************** NOTE: I've removed large chunks of this file, so it won't work ********************** ##
## ********************** NOTE: This is just to get the idea of where to edit ********************** ##
## **** @see https://davidsimpson.me/2014/02/27/an-alternative-to-renderconfluencemacro/#comment-188208 **** ##
## GLOBAL DECORATOR
## This decorator handles a global context, i.e. information which is independent of space.
## Supports modes: 'dashboard', 'userdir', 'rss'.
...