Skip to content

Instantly share code, notes, and snippets.

View zeekay's full-sized avatar
💎
👋

z zeekay

💎
👋
View GitHub Profile
@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 / 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 / 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 / cdf
Created September 25, 2013 05:58
Quickly cd to topmost Finder window.
function cdf {
pushd "`pwdf $@`";
}
@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 / 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 / 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 / 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 / create_bound_session.py
Last active January 1, 2016 03:58
Bind request sessions to an IP address.
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.connection import HTTPConnection, HTTPSConnection
from requests.packages.urllib3.connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from requests.packages.urllib3.poolmanager import PoolManager
def create_bound_session(source_address):
'''
Creates a requests session bound to a given source address. Proving once
@zeekay
zeekay / hoodoo.py
Created January 17, 2014 15:15
Old task management app I wrote years ago.
#!/usr/bin/env python2.7
"""
description
hoodoo is a task management app. tasks can be tagged, searched, sorted.
commands available
add <name> #<tag> add a new task
alias: +
opt: created=<date> due=<date> done=True/False, tags