Skip to content

Instantly share code, notes, and snippets.

@altercation
altercation / sp3pwrbtn-proc-acpi
Last active August 29, 2015 14:06
surface pro 3 - power button not detected - /proc/acpi tree
/proc/acpi
├── button
│   └── lid
│   └── LID0
│   └── state
└── wakeup
3 directories, 2 files
@altercation
altercation / sp3pwrbtn-proc-acpi-wakeup
Last active August 29, 2015 14:06
surface pro 3 - power button not detected - /proc/acpi/wakeup dump
Device S-state Status Sysfs node
WIFI S4 *disabled pci:0000:01:00.0
LID0 S3 *enabled platform:PNP0C0D:00
EC0 S3 *disabled platform:PNP0C09:00
XHC S4 *enabled pci:0000:00:14.0
HDEF S4 *disabled pci:0000:00:1b.0
TPD4 S4 *disabled
TPD7 S0 *disabled
TPD8 S0 *disabled
PEG0 S4 *disabled
@altercation
altercation / sp3pwrbtn-xinput
Created September 4, 2014 00:31
surface pro 3 - power button not detected - xinput dump
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ NTRG0001:01 1B96:1B05 Pen id=8 [slave pointer (2)]
⎜ ↳ NTRG0001:01 1B96:1B05 id=9 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=6 [slave keyboard (3)]
↳ Topre Corporation HHKB Professional id=7 [slave keyboard (3)]
@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 / 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