Skip to content

Instantly share code, notes, and snippets.

View monokrome's full-sized avatar
😻
meow

Bailey Stoner monokrome

😻
meow
View GitHub Profile
@monokrome
monokrome / itunes_receipts.py
Last active December 19, 2015 17:39
Search within a mailbox for iTunes receipts, and write a JSON representation of all iTunes receipts as 'receipts.json'.
#!/usr/bin/env python
import mailbox
mailbox_root = 'your_mailbox'
mailbox_type = mailbox.Maildir
###########################################
###########################################
## Configuration section finished. ##
@monokrome
monokrome / models.coffee
Last active December 19, 2015 12:28
Polymorphic relatedModel for backbone-associations
{polymorphic} = require 'polymorphic'
class OtherModel extends Backbone.Model
class YetAnotherOtherModel extends Backbone.Model
class MyModel extends Backbone.Model
relations: [
type: Backbone.One
key: 'otherUri'
@monokrome
monokrome / nginx
Last active December 19, 2015 11:58
Makes loading and running Homebrew's nginx on OS X easier.
#!/usr/bin/env sh
fail() {
echo "Failed to authenticate as superuser."
exit
}
# Verify that we have privileges or fail
test sudo || fail
@monokrome
monokrome / example.py
Created June 20, 2013 18:49
Templates using built-in Python string formatting.
from .utils import template
x = template('example.sh', '~', options='-al')
@monokrome
monokrome / .bash_profile
Created June 23, 2012 22:10
My.bash_profile for Arch Linux
#!/bin/bash
source /etc/bash_completion.d/git
# Any directories that should additionally be treated as prefixes.
additional_prefixes=(
"/usr/local"
"${HOME}"
)
@monokrome
monokrome / .xbindkeysrc
Created June 23, 2012 22:12
My configuration for xbindkeys
# Toggle between play/pause
"nyxmms2 toggle"
m:0x0 + c:172
XF86AudioPlay
# Increase volume
"amixer set Master playback 3+"
m:0x0 + c:123
XF86AudioRaiseVolume
@monokrome
monokrome / .xinitrc
Created June 23, 2012 08:43
My .xinitrc process for running window managers through SLiM.
#!/bin/bash
# An additional script that will execute for wm-specific configuration
wm_init_script = "${HOME}/.config/${1}/init.sh"
# Execute the window manager and save it's pid for later
exec $1 &
wm_pid = $!
# A bit of a time gap for the window manager to get started.
attr = 0
something = (x) ->
attr = x
something 40
console.dir attr
# Output: 40
@olivoil
olivoil / vim.rb
Created February 18, 2012 06:16 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.294'
def features; %w(tiny small normal big huge) end
@monokrome
monokrome / PS1.sh
Created December 31, 2011 01:50
My PS1
# Thanks to @kroogs for the idea of making the text red on errors :D
# This is a global reference to be used in order to know the last return
# code from within functions.
last_response_code=$?
# Formats the provided text into something a bit more striking.
error_text () { echo "\033[31m${@}\033[0m"; }
# Generates our PS1 when passed the last program's response code, and