- Save files to
~/.git/hooks/
- Make them executable:
chmod +x ~/.git/hooks/pre-{commit,push}
- Configure git to use these hooks:
git config --global core.hooksPath ~/.git/hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# A script to update all git repositories in a directory tree | |
# Run `rp status` to see the status of all repositories | |
# Run `rp update` to update all repositories that are on the main branch and have no uncommitted changes | |
my_project_dir=/path/to/my/git/repos | |
function print_status() { | |
tput bold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k=k$RANDOM | |
function r { | |
redis-cli -p 16379 $* | |
} | |
count=$1 | |
i=0 | |
while [ $i -lt $count ]; do | |
sleep .1 | |
let i+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
init=true | |
function do_stuff () { | |
while :; do | |
echo -n . | |
sleep .5 | |
done | |
} | |
while :; do | |
if [ "$(nc -l 9999)" = "on" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
based on | |
https://github.com/jlafon/ansible-profile | |
https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/timer.py | |
just throw this into a callback_plugins directory inside your playbooks directory | |
""" | |
import time | |
import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IPT="/sbin/iptables" | |
# Server IP | |
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')" | |
# Your DNS servers you use: cat /etc/resolv.conf | |
DNS_SERVER="8.8.4.4 8.8.8.8" | |
# Allow connections to this package servers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name WorldTimeBuddy hacks | |
// @description | |
// @namespace http://www.worldtimebuddy.com/ | |
// @include http://www.worldtimebuddy.com/* | |
// @match http://www.worldtimebuddy.com/* | |
// ==/UserScript== | |
(window.setTimeout(function(){ | |
document.getElementsByClassName("wrapper")[0].removeChild(document.getElementById("toprek")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prg { | |
WIDE="" | |
if [ "$1" == "-w" ] | |
then | |
WIDE="www" | |
shift | |
fi | |
processes=$(pgrep -- "$1") | |
if [ ! -z "${processes}" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat Gemfile | |
source :rubygems | |
gem "sinatra" | |
$ cat config.ru | |
require 'rubygems' | |
require 'bundler' | |
Bundler.require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use the 127.0.0.2 address of the loopback interface so that it doesn't interfere with other servers on localhost | |
echo '127.0.0.2 blog.facebook.com static.ak.connect.facebook.com www.facebook.com facebook.com static.ak.fbcdn.net connect.facebook.net creative.ak.facebook.com ads.ak.facebook.com ads.ak.facebook.com.edgesuite.net' | sudo tee -a /etc/hosts | |
# run a tiny ruby/rack app with unicorn to reply with an empty HTTP 200 response on all requests | |
sudo unicorn -D -l 127.0.0.2:80 -e 'lambda { |env| [ 200, {"Content-Type" => "text/plain"}, "" ] }' |
NewerOlder