Skip to content

Instantly share code, notes, and snippets.

@altercation
altercation / gist:7bd96cb41f4efd06b99a
Created September 5, 2014 10:28
Helper script to handle unplug events from my root usb hub on the surface pro 3
#!/usr/bin/env zsh
# plug/unplug usb to internal usb hub will suspend/resume machine
setopt EXTENDED_GLOB NO_UNSET ERR_EXIT
# udevadm info -a -p /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1
# udevadm test --action remove /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1
# sudo udevadm monitor --environment --udev
@altercation
altercation / usbhook
Created September 19, 2014 23:38
script to conditionally sleep surface pro 3 on removal of all external usb devices, with installers to set correct udev wake rules
#!/usr/bin/env zsh
setopt EXTENDED_GLOB NO_UNSET ERR_EXIT
typeset -g SCRIPTUSERHOME=/${(j:/:)${(s:/:)0:A}[1,2]} # TODO: probably a better way than this
typeset -g SCRIPTUSER=${${(s:/:)0:A}[2]} # TODO: probably a better way than this
typeset -g SCRIPTNAME="${${SCRIPTPATH:=$0:A}:t}"
typeset -g SCRIPTROOT="${SCRIPTPATH:h}"
typeset -g FUNCPATH=$SCRIPTROOT/functions
fpath=($FUNCPATH $fpath)
autoload $FUNCPATH/*(#q.:t)
@altercation
altercation / hhkb_avr.h
Created September 22, 2014 22:02
tmk firmware - hhkb avr
#ifndef HHKB_AVR_H
#define HHKB_AVR_H
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
@altercation
altercation / rst2man2_error
Last active August 29, 2015 14:08
rst2man2 fails trying to load python3.4 module...
palimpsest% python2 /usr/bin/rst2man2.py docs/MANUAL.rst offlineimap.1
Traceback (most recent call last):
File "/usr/bin/rst2man2.py", line 21, in <module>
from docutils.core import publish_cmdline, default_description
File "/usr/lib/python3.4/site-packages/docutils/core.py", line 246
print('\n::: Runtime settings:', file=self._stderr)
^
SyntaxError: invalid syntax
@altercation
altercation / dispmode
Last active August 29, 2015 14:16
Contextual workspace-resolution aware browser launcher for i3
#!/usr/bin/env zsh
{ eval "$(<${$(readlink -f $0):h}/functions/frontmatter)" } || :
xenvinit
# directly called modes
#
# external - external only
# internal - internal only
# scaled - internal scaled-mirror of external (presentation with scaled mirror for easy tablet use)
@altercation
altercation / testprep.sh
Last active August 29, 2015 14:20
test-machine-prep
cd $HOME
sudo apt-get --yes install festival sox ttf-mscorefonts-installer
# remove this exit for second run through
exit
wget http://wa.portal.airast.org/wp-content/uploads/browsers/WASecureBrowser6.5-Linux.tar.bz2
tar jxvf WASecureBrowser6.5-Linux.tar.bz2
cd WASecure*
bash install-icon.sh
@altercation
altercation / archblocks_error.sh
Created October 3, 2012 23:22
archblocks - no temp fs space error
JUST PRIOR TO ERROR:
# -----------------------------------------------------------------------------------------------
# df -a > /test/1/dump_df
# -----------------------------------------------------------------------------------------------
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 28507096 2636548 24422468 10% /
proc 0 0 0 - /proc
sys 0 0 0 - /sys
@altercation
altercation / handler.sh
Created January 21, 2013 01:29
current acpi handler for thinkpad x220 running arch
#!/bin/bash
case $* in
ac_adapter*) power auto ;; # unplug or plug ac cord
*LID*close) system sleep ;; # shut laptop lid
*TBLT*on*) displays tablet on ;; # rotate to tablet mode
*TBLT*off*) displays tablet off ;; # rotate to laptop mode
*0000500c) trigger Print ;; # undock tablet pen
*0000500b) trigger shift+Print ;; # dock tablet pen
esac
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match.
Instructions:
1. Set your Gnome theme as you would like it
2. Run with a command like "python wine_colors_from_gtk.py"
3. Restart any apps running in Wine. They should match the Gnome theme colors now.
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper
@altercation
altercation / cl.md
Last active September 12, 2016 02:01
Centurylink Consumer Fiber Experience

We signed up for the a CenturyLink fiber trial in December. This is fiber to the house. They provided a stock CL modem that hooked up via ethernet to their optical network terminal. This is a single point ethernet breakout which provides their IP based television service as well standard data connectivity.

First, we didn't care about the TV service but it was cheaper to go with it as part of the bundle. It never worked. This was never resolved, but not the reason we switched back to comcast.

We popped for the 100Mbs connectivity. The fiber can deliver up to 1Gbs. It's limited based purely on what you pay for.

I tested using multiple speed testing sites as well as iperf to dedicated servers, etc. Speeds were HIGHLY variable. Most of the time we were seeing real throughput of around 60-70Mbs. I could live with that if it weren't for the video issues detailed below.

For the first several days I saw random slow downs where effective bandwidth would be SUB 10Mbs. Rebooting the ONT fiber termination unit usuall