Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Wes Mason 1stvamp

:shipit:
View GitHub Profile
@1stvamp
1stvamp / gist:9133125
Created Feb 21, 2014
Testing reliability of typesafe === operator in PHP for use in unit tests
View gist:9133125
$ phpsh
Starting php
type 'h' or 'help' to see instructions & features
php> echo array('foo'=>'bar') === array('foo'=>'bar')
1
php> echo array('foo'=>'baz') === array('foo'=>'bar')
php> echo array('foo'=>array(1)) === array('foo'=>array())
php> echo array('foo'=>array(1)) === array('foo'=>array(1))
@1stvamp
1stvamp / celery_msgs.py
Created Feb 24, 2014
Simple tool for displaying contents of celery messages
View celery_msgs.py
from base64 import b64decode
from json import loads
from pprint import pprint
def parse_celery_msg(msg):
pprint(loads(b64decode(msg)))
View rename_files.sh
for NAME in ls $DIRPATH;
do
NAME2="${NAME#_}"
if [ "$NAME" != "$NAME" ]; then
mv $DIRPATH/$NAME $DIRPATH/$NAME2
fi
done
@1stvamp
1stvamp / lumi_header_fix.css
Last active Aug 29, 2015
Make the lumi.do header more useful (by making it get the hell out of my way)
View lumi_header_fix.css
#header
{
height: 69px !important;
position: absolute !important;
}
#header primary
{
height: 69px !important;
}
@1stvamp
1stvamp / keybase.md
Created Mar 28, 2014
My keybase info
View keybase.md

Keybase proof

I hereby claim:

  • I am 1stvamp on github.
  • I am 1stvamp (https://keybase.io/1stvamp) on keybase.
  • I have a public key whose fingerprint is 92B0 8721 F96D 152C 1C6B 3570 121D B795 2C93 970C

To claim this, I am signing this object:

@1stvamp
1stvamp / playboard.yaml
Created Jun 27, 2014
Graceful or hard restart of service in ansible based on changed binary
View playboard.yaml
---
- hosts: localhost
tasks:
- name: check for new payload
tags: config-changed
shell: if [ "$(md5sum {{ executable_path }})" != "$(cat {{ executable_md5_path }})" ]; then echo "changed"; fi
register: md5diff
changed_when: md5diff.stdout == "changed"
- name: store new payload md5
@1stvamp
1stvamp / snappy-ppa-1500
Created Dec 15, 2014
apt pinning preferences for snappy ppa
View snappy-ppa-1500
Package: *
Pin: release o=LP-PPA-snappy-dev-beta
Pin-Priority: 15000
View rfc-snappy-ports.md

The current situation

The current spec states that ports are a top level entry in the package.yaml as

    name: go-example-webserver
    vendor: Alexander Sack <asac@canonical.com>
    architecture: amd64
    icon: meta/go.svg
    version: 1.0.1
@1stvamp
1stvamp / high_fives.py
Last active Aug 29, 2015
Example of returning multiple directed commands in a hippybot plugin
View high_fives.py
from hippybot.decorators import botcmd
class Plugin(object):
command_aliases = {'^5s': 'high_fives'}
@botcmd
def high_fives(self, msg, **kwargs):
users = [
unicode(msg.getFrom()).split("/")[1].replace(' ', ''),
'bob',
'alice']
@1stvamp
1stvamp / switch-noise-cancellation.sh
Created May 26, 2015
Automatically adjust noise cancellation for X220 clickpad if plugged into power
View switch-noise-cancellation.sh
#!/bin/sh
# /usr/lib/pm-utils/power.d/switch-noise-cancellation.sh
case $1 in
true) DISPLAY=:0 xinput --set-prop "SynPS/2 Synaptics TouchPad" 303 60, 60 ;;
false) DISPLAY=:0 xinput --set-prop "SynPS/2 Synaptics TouchPad" 303 15, 15 ;;
esac
exit 0