Skip to content

Instantly share code, notes, and snippets.

View nasamuffin's full-sized avatar
💭
probably hanging out with dog

Emily Shaffer nasamuffin

💭
probably hanging out with dog
View GitHub Profile
@nasamuffin
nasamuffin / npp-rgrep
Created January 29, 2014 20:18
Finds files containing the search string and feeds them to Notepad++. Assumes 'npp' is aliased to the full path of notepad++.exe. Automagically sets focus in each file to the line where the search string matched!
echo $(grep -rIn "$@" | cut -d":" -f1-2 --output-delimiter=" -n" | rev | uniq -f1 | rev ) | xargs -n2 npp &
@nasamuffin
nasamuffin / UPS Track
Last active August 29, 2015 13:56
Track a UPS package (so you don't have to do it yourself).
#!/bin/bash
RETVAL=1
while [ "$RETVAL" -eq "1" ]; do
sleep 1m
PAGECONTENT=$(wget "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=$1" --quiet -O -)
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo "$PAGECONTENT" | grep -q Delivered
RETVAL=$?
fi
@nasamuffin
nasamuffin / gist:fd6687861851f7f2dbcf
Created March 18, 2015 03:16
gpio control registers
0: 50600801 0000001D 00000000 00000000
10: 00000000 00000000 00000000 00000000
20: 00000000 00000000 00000000 00000000
30: 00000000 00000000 00000000 00000000
40: 00000000 00000000 00000000 00000000
50: 00000000 00000000 00000000 00000000
60: 00000000 00000010 00000000 00000000
70: 00000000 00000000 00000000 00000000
80: 00000000 00000000 00000000 00000000
90: 00000000 00000000 00000000 00000000
#define _BEAGLEBONE_GPIO_H_
#define GPIO1_START_ADDR 0x4804C000
#define GPIO1_END_ADDR 0x4804DFFF
#define GPIO1_SIZE (GPIO1_END_ADDR - GPIO1_START_ADDR)
#define GPIO_OE 0x134
#define GPIO_SETDATAOUT 0x194
#define GPIO_CLEARDATAOUT 0x190
#define USR0_LED (1<<21)
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <iostream>
#define OE_ADDR 0x134
#define GPIO_DATAOUT 0x13C
#define GPIO_DATAIN 0x138
#define GPIO0_ADDR 0x44E07000
#define GPIO1_ADDR 0x4804C000
#define GPIO2_ADDR 0x481AC000
@nasamuffin
nasamuffin / utterances
Last active August 30, 2015 18:01
how to ask for weaknesses list
WeaknessesIntent what is {grass|Type} weak against
WeaknessesIntent what are the weaknesses for {grass|Type}
WeaknessesIntent what does {grass|Type} lose to
WeaknessesIntent what are {grass|Type}'s weaknesses
WeaknessesIntent what is super effective against {grass|Type}
WeaknessesIntent what deals the most damage to {grass|Type}
WeaknessesIntent what hurts {grass|Type} the most
WeaknessesIntent what types are {grass|Type} weak against
WeaknessesIntent what types are {grass|Type} weak to
WeaknessesIntent what should I use against {grass|Type}
@nasamuffin
nasamuffin / Stockbroker-slackbot
Last active November 23, 2015 15:29
AWS lambda implementation of a slackbot stockbroker app
import json
import urlparse
import urllib
import re
print('Loading function')
def lambda_handler(event, context):
if not 'text' in urlparse.parse_qs(event['postBody']):
@nasamuffin
nasamuffin / wewscript.py
Last active March 4, 2016 02:21
WEWLAD
import sys
import string
import unicodedata
def pad(width):
return uni(" ") * width
def uni(stringy):
ascii_to_wide = dict((i, unichr(i + 0xfee0)) for i in range(0x21, 0x7f))
ascii_to_wide.update({0x20: u'\u3000', 0x2D: u'\u2212'}) # space and minus
@nasamuffin
nasamuffin / grammar-police
Created May 26, 2016 23:21
Grammar-police's logic
import json
import urlparse
import urllib
import re
def lambda_handler(event, context):
text = urlparse.parse_qs(event['postBody'])['text'][0]
username = urlparse.parse_qs(event['postBody'])['user_name'][0]
if username == "slackbot":
print("I don't even listen to myself.")
0xA0:
sensorType: 0x02
path: /xyz/openbmc_project/sensors/voltage/vout1
sensorReadingType: 0x01
multiplierM: 51
offsetB: 0
bExp: 0
mutability: Mutability::Read | Mutability::Write
interfaces:
xyz.openbmc_project.Sensor.Value: