Skip to content

Instantly share code, notes, and snippets.

View zeekay's full-sized avatar
💎
👋

z zeekay

💎
👋
View GitHub Profile
@zeekay
zeekay / irssi.rb
Created December 15, 2013 07:44
Homebrew formula for irssi with znc privmsg patch.
require 'formula'
class Irssi < Formula
homepage 'http://irssi.org/'
url 'http://irssi.org/files/irssi-0.8.15.tar.bz2'
sha1 'b79ce8c2c98a76b004f63706e7868cd363000d89'
option "without-perl", "Build without perl support."
depends_on :clt # See https://github.com/Homebrew/homebrew/issues/20952
@zeekay
zeekay / cake
Created November 22, 2013 20:33
Cake wrapper to push task to end of argument (after options).
#!/usr/bin/env node
// Treat first argument to cake as task name, push it to the end so cake agrees
if (process.argv[2] && process.argv[2].charAt(0) !== '-') process.argv.push(process.argv.splice(2, 1)[0])
require('coffee-script/lib/coffee-script/cake').run();
@zeekay
zeekay / say-hi.py
Last active May 19, 2017 20:58
IRC chat client in < 60 lines of code.
#!/usr/bin/env python
#
# Minimal IRC client. Compatible with Python 2 and 3.
import os, select, signal, socket, sys, time
try: username = os.getlogin()
except: username = "unknown"
hostname = socket.gethostname()
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@zeekay
zeekay / osx-bootstrap.sh
Last active February 1, 2022 05:49
My Mac OSX bootstrap script.
#!/bin/sh
# Bootstrap new OSX system with common CLI utilities and scripts.
# Prereq:
# Install java from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
export PATH=~/.ellipsis/bin:/usr/local/bin:$PATH
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@zeekay
zeekay / cdf
Created September 25, 2013 05:58
Quickly cd to topmost Finder window.
function cdf {
pushd "`pwdf $@`";
}
@zeekay
zeekay / iterm2visor.sh
Last active December 23, 2015 20:29
Create a copy of iTerm called iTermVisor which will run in background on login, only uses visor.
create-visor() {
local p='/Applications'
cp -rf $p/iTerm.app $p/iTermVisor.app
mv $p/iTermVisor.app/Contents/MacOS/iTerm $p/iTermVisor.app/Contents/MacOS/iTermVisor
defaults write $p/iTermVisor.app/Contents/Info CFBundleIdentifier com.googlecode.iterm2visor
defaults write $p/iTermVisor.app/Contents/Info CFBundleExecutable iTermVisor
defaults write $p/iTermVisor.app/Contents/Info CFBundleName iTermVisor
defaults write $p/iTermVisor.app/Contents/Info LSUIElement 1
rm -rf ~$p/iTermVisor.app
mv $p/iTermVisor.app ~$p
@zeekay
zeekay / irssi-notify
Created September 17, 2013 19:09
Native notifications for remote irssi on OSX.
#!/bin/sh
# Native notifications for remote irssi on OSX 10.8+.
#
# Requires:
# fnotify.pl (https://github.com/rndstr/fnotify/blob/master/fnotify.pl)
# terminal-notifier (https://github.com/alloy/terminal-notifier)
#
# Usage:
# Load fnotify.pl in irssi (`script load fnotify`). Run `irssi-notify
@zeekay
zeekay / server.js
Created September 6, 2013 20:57
Script injection example.
var http = require('http'),
stream = require('stream');
var config = {
host: 'nodejs.org',
target_port: 80,
listen_port: 8042,
script: '<script>alert("hi")</script>',
};
@zeekay
zeekay / vim-centos.sh
Created July 31, 2013 18:12
Install Vim 7.3 on CentOS.
#!/bin/sh
# install deps
yum install -y gcc make ncurses-devel ruby ruby-devel python python-devel wget
# download vim sources
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
bunzip2 vim-7.3.tar.bz2 && tar xvf vim-7.3.tar
cd vim73
@zeekay
zeekay / inject-args.coffee
Created June 26, 2013 20:08
Why would anyone ever want to do this? Reasons...
injectArgs = (func, args...) ->
rawFunc = func.toString()
argNames = (a.trim() for a in (/function \((.*)\)/.exec rawFunc)[1].split(','))
func = rawFunc.replace /function \((.*)\)/, 'function anonymous()'
if args.length != argNames.length
throw new Error 'Function arity must match number of passed arguments'
unless args.length > 0
return new Function func