Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dghodgson on github.
  • I am dghodgson (https://keybase.io/dghodgson) on keybase.
  • I have a public key ASBy4X-kSNPYQH0Uzh0C9rs1EC6BHPKThSVAL8Kejq-rQAo

To claim this, I am signing this object:

@dghodgson
dghodgson / traceback.sh
Last active May 20, 2018 20:24 — forked from docwhat/traceback_example.bash
A template showing how to do bash tracebacks. This makes using `set -eu` much more comfortable.
# Tracebacks in bash
# https://docwhat.org/tracebacks-in-bash/
#
# Just take the code between the "cut here" lines
# and put it in your own program.
#
# Written by Christian Höltje
# Donated to the public domain in 2013
set -eu
@dghodgson
dghodgson / 89-fix-intel-scu.rules
Last active January 3, 2019 23:41
Major rewrite, Change ID_PATH to use `scsi_default` pattern, Add support for handling partitions
### Reset the device's path variables and symlinks
KERNEL=="sd*", ENV{DEVTYPE}=="disk" SUBSYSTEM=="block", DRIVERS=="isci", PROGRAM="/usr/local/bin/udev-fix-intel-scu.sh $kernel $env{DEVPATH} $env{ID_PATH} $env{ID_WWN} $env{ID_SERIAL}", ENV{ID_PATH_TAG}="%c{1}", ENV{ID_PATH}="%c{4}", SYMLINK="disk/by-id/%c{2} disk/by-id/%c{3} disk/by-path/%c{4}"
KERNEL=="sd*", ENV{DEVTYPE}=="partition" SUBSYSTEM=="block", DRIVERS=="isci", PROGRAM="/usr/local/bin/udev-fix-intel-scu.sh $kernel $env{DEVPATH} $env{ID_PATH} $env{ID_WWN} $env{ID_SERIAL}", ENV{ID_PATH_TAG}="%c{1}", ENV{ID_PATH}="%c{4}", SYMLINK="disk/by-id/%c{2}-part%n disk/by-id/%c{3}-part%n disk/by-path/%c{4}-part%n"
### No modifications to symlinks or properties, used for testing
#KERNEL=="sd*", SUBSYSTEM=="block", DRIVERS=="isci", PROGRAM="/usr/local/bin/udev-fix-intel-scu.sh $kernel $env{DEVPATH} $env{ID_PATH} $env{ID_WWN} $env{ID_SERIAL}"
@dghodgson
dghodgson / pulseaudio-auto-loopback.py
Last active December 15, 2019 05:29
A python script for automatically adding a loopback module to Pulse Audio for a bluetooth audio source when it's connected, and automatically removing the loopback module when the bluetooth device disconnects.Original code found here: https://gist.github.com/joergschiller/1673341/#comment-802735
#!/usr/bin/python
# based on monitor-bluetooth
# Changes by Domen Puncer <[email protected]>
import gobject
import dbus
import dbus.mainloop.glib
import os
@dghodgson
dghodgson / satoshi_circle_martingale
Created April 28, 2013 04:19
Shell script for simulating a martingale style betting system for Satoshi Circle. Accepts a file with random sequences of numbers 0 through 16 as input (to determine which value the wheel landed on).
#!/bin/bash
rand=$1
line_start=$2
float_scale=9
start_bal=0.25
start_bet=0.000004234
max_bet=0.25
bet_mult=2.5
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}