Skip to content

Instantly share code, notes, and snippets.

@sleepygarden
sleepygarden / supermoji.py
Last active August 29, 2015 14:01
Supermoji - make your Hipchat emojis super!
# all forms must be the same height. each line in a form must be the same width, but each form's width may differ. blank lines are permitted at the top and bottom of each form.
A = """
XXXX
X X
XXXX
X X
X X
"""
B = """
XXX
@sleepygarden
sleepygarden / clickgasm.py
Created June 7, 2014 20:41
Clickgasm.py - You ever wanna click something on OSX, like, really really fast?
"""
clickgasm.py, clicks an x,y point n times on OSX realllly fast
usage: "python clickgasm.py <click x,click y> <loop count>"
sleepygarden 2014
"""
import sys
import time
import datetime
@sleepygarden
sleepygarden / arc-storage.js
Created December 2, 2015 21:38
ARC Storage - localStorage which syncs across tabs and clears once all tabs using it are gone
// ARC Storage - localStorage which syncs across tabs and clears once all tabs using it are gone.
// refreshing with a single tab open also wipes it
// tries awful hardto match the Storage API, but uses
var ARCStorage = (function(){
var arcStorage = {}, arcStoreSharers = 0, didInitSync = false;
$(window).focus(function() {
sync();
});
@sleepygarden
sleepygarden / clearly-zsh.sh
Last active December 22, 2015 14:48
Clear up zsh - when changing dirs without cd, will check if that will conflict with a command.
#!/bin/zsh
. ~/.zshrc
check_for_collision(){
is_exec=false
is_dir=false
if [ -d $FOO ]; then
is_dir=true
fi
alias $FOO > /dev/null && is_exec=true
echo "E"$is_exec
@sleepygarden
sleepygarden / banner.py
Last active December 22, 2015 18:59
pretty print a justified banner with colorama
# auto banner
import colorama
from colorama import Fore, Back, init
if __name__ == "__init__":
init()
def print_banner(banner_lines, fg=Fore.WHITE, bg=Back.BLACK, offset=0):
'''
prints all lines in list "banner_lines" justified by <'s or >'s, with
at least "offset" of each on each side of a line.
@sleepygarden
sleepygarden / gitlog.py
Created September 13, 2013 18:05
simple python git interface with tagging and tag searching.
# gitlog.py
# -*- coding: utf-8 -*-
import subprocess
import sys
#tag ideas? you can implement your own!
INFO_TAG="[INFO]" # just a heads up, default tag
FUCK_TAG="[FUCK]" # something broke! :c
CLEAN_TAG="[CLEAN]" # ripped out stuff, removed comments, etc
TODO_TAG="[TODO]" # didn't finish what i was doing
@sleepygarden
sleepygarden / finger.py
Last active December 24, 2015 01:29
the finger, she flips
# -*- coding: utf-8 -*-
"""
useage: import finger
finger.flip()
"""
finger = """
/´¯/)
,/¯ /
/ /
/´¯/' '/´¯¯`·¸
@sleepygarden
sleepygarden / unicode_clippy.py
Created September 27, 2013 21:09
trying to make sense of unicode_ebooks
# -*- coding: utf-8 -*-
import sys
import enchant
"""
trying to make sense of unicode_ebooks
you need pyenchant:
brew install enchant
pip install pyenchant
"""
@sleepygarden
sleepygarden / uploadHandler.js
Created February 8, 2016 19:02
Handle click to upload and drag to upload
function init(){
// default behavior is always show copy icon, open file in new window. override that!
window.addEventListener('dragover', function(e){
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'none';
});
window.addEventListener('drop', function(e){
e.stopPropagation();
e.preventDefault();
@sleepygarden
sleepygarden / PListValidation.h+m
Created April 10, 2014 19:25
Validates NSDictionaries and NSArrays to check if they can writeToFile: (and are a valid PList)
//
// PListValidation.h
// Created by Michael Cornell on 4/8/14.
// Beerware License
//
// Validates Dictionaries and Arrays to check if they can writeToFile: (and are a valid PList)
#import <Foundation/Foundation.h>
@interface NSDictionary (PListValidation)