Skip to content

Instantly share code, notes, and snippets.

View unhammer's full-sized avatar
kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

kevin :: Coffee → Code
View GitHub Profile
@wmerrifield
wmerrifield / build+archive.sh
Created November 8, 2010 17:53
A shell script to perform the equivalent of Xcode's "Build & Archive" command.
#!/bin/sh
#
# Copyright (c) 2010 Warren Merrifield
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@slackorama
slackorama / js-beautify.el
Created November 23, 2010 19:51
beautify some js code in emacs
;;; js-beautify.el -- beautify some js code
(defgroup js-beautify nil
"Use jsbeautify to beautify some js"
:group 'editing)
(defcustom js-beautify-args "--jslint-happy --brace-style=end-expand --keep-array-indentation"
"Arguments to pass to jsbeautify script"
:type '(string)
:group 'js-beautify)
@unhammer
unhammer / pylibtextcat.arch.patch
Created December 16, 2010 14:52
patch to make pylibtextcat run on Arch Linux
diff -rupN original/pylibtextcat-0.1//libtextcat.c pylibtextcat-0.1//libtextcat.c
--- original/pylibtextcat-0.1//libtextcat.c 2008-06-18 01:26:04.000000000 +0200
+++ pylibtextcat-0.1//libtextcat.c 2010-12-16 15:35:27.560001525 +0100
@@ -1,4 +1,4 @@
-#include <libtextcat/textcat.h>
+#include <textcat.h>
#include "libtextcat.h"
static const char __author__[] =
@@ -32,7 +32,7 @@ libTextCat_init(libTextCatObject *self,
@tavisrudd
tavisrudd / readline_clipboard.sh
Created August 24, 2011 20:18
bash readline integration with clipboards: M-k = kill, M-y = yank, M-u = backwards kill
## derived from http://stackoverflow.com/questions/994563/integrate-readlines-kill-ring-and-the-x11-clipboard
## You need to choose which clipboard to integrate with, OS X or X11:
shell_copy() {
pbcopy # OS X
# or ssh user@remote_mac pbcopy
# or xclip
}
shell_yank() {
@unhammer
unhammer / window-toggle-decorations.py
Created February 13, 2012 08:55
toggle gtk window decorations
#! /usr/bin/python2
import gtk.gdk
w = gtk.gdk.window_foreign_new( gtk.gdk.get_default_root_window().property_get("_NET_ACTIVE_WINDOW")[2][0] )
w.set_decorations( (w.get_decorations()+1)%2 ) # toggle between 0 and 1
gtk.gdk.window_process_all_updates()
gtk.gdk.flush()
# now bind this to super-r or something
@jimregan
jimregan / irish.sbl
Created March 15, 2012 20:55
Irish stemmer
routines (
R1 R2 RV
initial_morph
mark_regions
noun_sfx
deriv
verb_sfx
)
externals ( stem )
@1stvamp
1stvamp / mac-curl-ca-bundle.sh
Created March 22, 2012 12:50
Script to install cURL CA certificates on OS X without macports
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else
@jimregan
jimregan / apertium-cleanstream.cc
Created April 2, 2012 12:21
Simple file to clean an Apertium stream.
/*
* Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@unhammer
unhammer / to-utf.sh
Created April 20, 2012 10:30
turn an unholy jumble of iso-SOMETHING and UTF-8 into UTF-8
#!/bin/bash
decodehtmlentities='#!/usr/bin/env python2
import sys, codecs
sys.stdin = codecs.getreader("utf-8")(sys.stdin)
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
sys.stderr = codecs.getwriter("utf-8")(sys.stderr)
import HTMLParser
h = HTMLParser.HTMLParser()
anonymous
anonymous / stdin.sh
Created May 29, 2012 20:31
stdin
#!/bin/bash
set -f # no globbing, so we can safely use *
# other_local[joe]=:0, other_local[bob]=:1 etc. for all active local
# users other than us:
unset other_local; declare -A other_local;
while read -rd $'\t'; do
IFS=$',\n' r=($REPLY)
[[ "${#r[@]}" -ge 4 && "${r[4]}" != '*' && "${r[2]}" != '' && "${r[0]}" != '' ]] && other_local[${r[2]}]=${r[0]}