Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View micahwalter's full-sized avatar
👋

Micah Walter micahwalter

👋
View GitHub Profile
import sys
import struct
import select
def parse_scanner_data(scanner_data):
upc_chars = []
for i in range(0, len(scanner_data), 16):
chunk = scanner_data[i:i+16]
# __ __ __ __ __ __ __ __ 01 00 __ 00 00 00 00 00
#!/usr/bin/python
import csv
import cooperhewitt.api.client
access_token = 'API_KEY'
hostname = 'api.collection.cooperhewitt.org'
if __name__ == "__main__":
function success(position) {
var s = document.querySelector('#status');
s.innerHTML = "found you at " + position.coords.latitude + " " + position.coords.longitude;
}
function error(msg) {
var s = document.querySelector('#status');
s.innerHTML = typeof msg == 'string' ? msg : "failed";
}
@micahwalter
micahwalter / archive_sms.js
Last active August 29, 2015 14:01
archive_sms.js
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
// simple schema for Mongo
var MessageSchema = new Schema({
archived: {
type: Date,
default: Date.now
},
message_id: {
;; fix for php-mode
(require 'cl)
;; package manager stuff
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(setq package-enable-at-startup nil)
(package-initialize)
@micahwalter
micahwalter / post-receive
Created May 14, 2015 11:32
post receive deploy hook
#!/bin/sh
# Check out the code on this server.
GIT_WORK_TREE=/home/git/working/<username>/<projectname> git checkout -f
# Define an array of servers to which the code will be deployed.
SERVERS="abc.example.com, xyz.example.com"
# Push codebase to the servers via rsync.
for SERVER in $SERVERS
@micahwalter
micahwalter / gists.py
Created June 19, 2015 21:17
gists.py
#!/usr/bin/env python
# Clone or update all a user's gists
# curl -ks https://raw.github.com/gist/5466075/gist-backup.py | USER=fedir python
# USER=fedir python gist-backup.py
import json
import urllib
from subprocess import call
from urllib import urlopen
import os
#!/bin/bash
DATESTRING="$(date -I)"
DATADIR="data/"
DATAFILE="${DATESTRING}_objects.csv"
DUMPFILE="${DATADIR}${DATESTRING}_objects.csv"
AWS_ACCESS_KEY="$(cat aws_access_key)"
AWS_SECRET_ACCESS_KEY="$(cat aws_secret_access_key)"
export PGPASSWORD="$(cat redshift_pass)"
@micahwalter
micahwalter / git-remove-history.sh
Created November 16, 2009 07:46
Script to permanently delete files/folders from your git repository.
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0are still
@micahwalter
micahwalter / .gitignore
Created August 18, 2010 03:35 — forked from redoPop/.gitignore
wordpress .gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your