Skip to content

Instantly share code, notes, and snippets.

@progrium
progrium / codep
Last active July 23, 2018 20:33
Creates a co-dependent process cluster, the first half of a "one for all" supervision strategy
#!/bin/bash
codep() {
set -eo monitor
trap 'kill $(jobs -p) &> /dev/null' EXIT
trap 'exit 2' CHLD
for child in "$@"; do
$child &
done
wait
@wolever
wolever / profile
Created September 11, 2013 15:41
My very fast Bash prompt, which shows git branch, virtualenv, and background jobs
# prompt examples:
# [3 jobs master virtualenv] ~/code/myproject/foo
# [1 job my-branch virtualenv] ~/code/bar/
# [virtualenv] ~/code/
# ~
# Very, very fast, only requiring a couple of fork()s (and no forking at all to determine the current git branch)
if [[ "$USER" == "root" ]]
then
export PS1="\e[1;31m\]\u \[\e[1;33m\]\w\[\e[0m\] ";
@burke
burke / remotepaste.md
Last active June 15, 2024 12:55
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@partkyle
partkyle / install-git
Last active December 19, 2015 00:39 — forked from jcf/Download and install git from source
install git from source into $HOME
set -e
LOCAL=$HOME/local
mkdir -p $HOME/build
cd $HOME/build
VERSION='1.8.3.1'
wget http://www.kernel.org/pub/software/scm/git/git-$VERSION.tar.gz
tar xzvf git-$VERSION.tar.gz
@partkyle
partkyle / tooltip.js
Created November 8, 2011 23:04
Quick little tooltip idea
(function($, window, undefined) {
$.fn.tooltip = function(options) {
options = $.extend(options, {
title: 'needs a title',
body: 'tst',
position: 'left'
});
$('<div>') // 50 other elements
// '<div>'....