Skip to content

Instantly share code, notes, and snippets.


Dave Williams daveio

View GitHub Profile
daveio /
Last active Feb 23, 2016
What has the EU ever done for us?

This letter was originally published by [Guardian Letters][0], and has been reformatted for clarity and ease of reading. Other than minor punctuation and significant layout changes, it is presented verbatim.

At last we may get a debate on Britain's relationship with Europe ([Leader][1], 11 January). What did the EEC/EU ever do for us? Not much, apart from:

  • Providing 57% of our trade.
  • Structural funding to areas hit by industrial decline.
  • Clean beaches and rivers.
  • Cleaner air.
  • Lead free petrol.
  • Restrictions on landfill dumping.
daveio /
Created Feb 10, 2018
Stream from the Raspberry Pi Camera to YouTube Live
# Stream from the Pi camera to YouTube Live.
# Uses information from
# Modified to use v4l2 directly (lower cpu, lower latency, higher frame rate, basically More Better)
# Setup: standard Pi Camera setup, then sudo apt-get install libav-tools
# You may need to modify the horizontal and vertical flip options to suit your mount.
daveio / autorefresh.js
Last active Sep 13, 2018
Auto-refresh for Twitter Web
View autorefresh.js
/* Enable commented lines (beneath this documentation) if you want to use in a userscript or similar,
otherwise copy all uncommented lines (or the whole gist) and paste into the javascript console.
Note that the update will only happen if you're scrolled all the way to the top. This prevents the
page jumping around when the update happens.
If you're pasting into the Javascript console, bear in mind that if you refresh with your browser,
the functionality will be lost and you'll need to paste it in again.
MIT licenced
Dave Williams (github:daveio), September 2018 */
// $(document).ready(function () {
daveio / result.txt
Created Sep 19, 2018
Did we find Vulcan?
View result.txt
g(earth) = 9.81
g(vulcan) = g(earth) * 1.4
g(vulcan) = 9.81 * 1.4
g(vulcan) = 13.734
G = 6.67408e-11
M(earth) = 5.972e24

You have a shredder connected to an empty box, and various rubber balls. The balls are all the same colour, each ball of a certain type is identical, and each type is made of a different material from each other type. The shredder is special, in that if you put a ball in the shredder, the pattern of the shredded-up remains in the box will be the same every time, but distinct from any other type of ball.

You want to demonstrate to someone who does not know a secret that you and Bob both know that secret. The secret is a sequence of four balls of any type.

The secret value is a Type 1 ball, followed by a Type 2 ball, a Type 3 ball, and a Type 4 ball.

Bob puts his four balls in the machine, one after the other, and the resulting state of the box is a chaotic mess; each shredded bit has been buffeted around by all the other shredded bits. It looks nothing like any one ball’s pattern.

The state of the box is a hash of the secret information.

daveio /
Created Apr 11, 2019
keybase proof

Keybase proof

I hereby claim:

  • I am daveio on github.
  • I am dave ( on keybase.
  • I have a public key ASC4CBtFVpJlyTVB1Kk42Fl748ngJZpT6WqQ5w21o8ABZAo

To claim this, I am signing this object:


Acamprosate (Campral) – prescribed alongside counselling to treat alcohol dependence.

Aciclovir (Acyclovir) – an antiviral medication primarily used for the treatment of herpes simplex virus infections, chickenpox, and shingles.

Allopurinol (Zyloprim) – to decrease high blood uric acid levels. It is specifically used to prevent gout, prevent specific types of kidney stones and for the high uric acid levels that can occur with chemotherapy.

Amlodipine (Norvasc) – is a medication used to treat hypertension (high blood pressure) and coronary artery disease.

Baclofen (Lioresal) – to treat spasticity. It is used as a central nervous system depressant and skeletal muscle relaxant.

daveio / foo.rb
Last active Feb 15, 2020
ruby 'in' keyword abuse
View foo.rb
# hi
# let's imagine we have this kind of structure for a website user. the user can add arbitrary websites,
# which are stored in the userdata[:websites] hash as { :user_selected_name => '' }.
userdata = {
username: 'dave',
websites: {
homepage: '',
twitter: ''
daveio /
Created Apr 27, 2020 attestation
xLrRsTkVjzReNoF M6ZcVecUkmypKNE KBpgihlKU5rAdFY GSgjJpTwuUbVkeL
HqC76slJXGOhcdc lr9dyS6CBvJTCKq 6Xr2MZHgg6Ne5dT Inb9J4iBiezDeHs
bbQGA3nH1BURZKX YaOaHkp8e8RVDjm k0T4qSNGMMdxXwU o2k0GKlBxCj705z
3vq7qbCpCF1lOiC YEGtzZU5KbqhlNZ FS1g221.
daveio /
Created Jan 15, 2021
dante sending socks requests out alternate interface
# get dante to use uid 'proxy' for priv and unpriv
# echo "201 fastlane" >> /etc/iproute2/rt_tables
ip rule add fwmark 0x1 table fastlane
ip route add default via dev fastlane table fastlane
iptables -A OUTPUT -t mangle ! -d -m owner --uid-owner proxy -j MARK --set-mark 1
iptables -t nat -A OUTPUT -m owner --uid-owner proxy -p udp --dport 53 -j DNAT --to
iptables -t nat -A OUTPUT -m owner --uid-owner proxy -p tcp --dport 53 -j DNAT --to