Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Hodgson Toasty27

View GitHub Profile
@Toasty27
Toasty27 / traceback.sh
Last active May 20, 2018 — forked from docwhat/traceback_example.bash
A template showing how to do bash tracebacks. This makes using `set -eu` much more comfortable.
View traceback.sh
# 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
@Toasty27
Toasty27 / keybase.md
Created Oct 22, 2017
Keybase Proof of Identity
View keybase.md

Keybase proof

I hereby claim:

  • I am toasty27 on github.
  • I am toasty27 (https://keybase.io/toasty27) on keybase.
  • I have a public key ASD4Q1aeulG_JsZ0BZ7WYEBxRUhvOHgQXoG_QO2k8XGuiwo

To claim this, I am signing this object:

@Toasty27
Toasty27 / 89-fix-intel-scu.rules
Last active Jan 3, 2019
Major rewrite, Change ID_PATH to use `scsi_default` pattern, Add support for handling partitions
View 89-fix-intel-scu.rules
### 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}"
@Toasty27
Toasty27 / pulseaudio-auto-loopback.py
Last active Dec 15, 2019
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
View pulseaudio-auto-loopback.py
#!/usr/bin/python
# based on monitor-bluetooth
# Changes by Domen Puncer <domen@cba.si>
import gobject
import dbus
import dbus.mainloop.glib
import os
@Toasty27
Toasty27 / satoshi_circle_martingale
Created Apr 28, 2013
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).
View satoshi_circle_martingale
#!/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
View ios-viewport-scaling-bug-fix-original.js
// 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";
}
}
You can’t perform that action at this time.