Skip to content

Instantly share code, notes, and snippets.

View 1stvamp's full-sized avatar
:shipit:

Wes Mason 1stvamp

:shipit:
View GitHub Profile
@1stvamp
1stvamp / gist:9133125
Created February 21, 2014 12:00
Testing reliability of typesafe === operator in PHP for use in unit tests
$ 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 February 24, 2014 15:42
Simple tool for displaying contents of celery messages
from base64 import b64decode
from json import loads
from pprint import pprint
def parse_celery_msg(msg):
pprint(loads(b64decode(msg)))
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 August 29, 2015 13:57
Make the lumi.do header more useful (by making it get the hell out of my way)
#header
{
height: 69px !important;
position: absolute !important;
}
#header primary
{
height: 69px !important;
}
@1stvamp
1stvamp / keybase.md
Created March 28, 2014 11:45
My keybase info

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 June 27, 2014 21:31
Graceful or hard restart of service in ansible based on changed binary
---
- 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 December 15, 2014 23:22
apt pinning preferences for snappy ppa
Package: *
Pin: release o=LP-PPA-snappy-dev-beta
Pin-Priority: 15000

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 August 29, 2015 14:21
Example of returning multiple directed commands in a hippybot plugin
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 16:51
Automatically adjust noise cancellation for X220 clickpad if plugged into power
#!/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