Skip to content

Instantly share code, notes, and snippets.

View aalemayhu's full-sized avatar
💭
If at first the idea is not absurd, then there is no hope for it - Albert

Alexander Alemayhu aalemayhu

💭
If at first the idea is not absurd, then there is no hope for it - Albert
View GitHub Profile
@jaxbot
jaxbot / gist:5748513
Created June 10, 2013 12:58
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@dtgay
dtgay / gpgwot
Created April 20, 2013 15:28
visualize GPG key web of trust
#!/bin/bash
gpg --list-sigs --keyring ~/.gnupg/pubring.gpg | sig2dot > ~/.gnupg/pubring.dot
neato -Tps ~/.gnupg/pubring.dot > ~/.gnupg/pubring.ps
convert ~/.gnupg/pubring.ps ~/.gnupg/pubring.gif
eog ~/.gnupg/pubring.gif
# /usr/bin/notify-site-is-down.rb
require "rubygems"
require "twilio-ruby"
account_sid = ENV["TWILIO_ACCOUNT_SID"]
auth_token = ENV["TWILIO_AUTH_TOKEN"]
@client = Twilio::REST::Client.new account_sid, auth_token
@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@xaviervia
xaviervia / gist:3390651
Created August 19, 2012 00:54
Nice and short: how to redirect Port 4567 into 80 in Ubuntu
# Because you want to run Ruby as a regular user and not as root, don't you?
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4567
# Source: http://serverfault.com/questions/112795/how-can-i-run-a-server-on-linux-on-port-80-as-a-normal-user?answertab=votes#tab-top
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@douglas
douglas / update_git_repos.sh
Created October 14, 2011 15:04
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
@erichocean
erichocean / gist:799195
Created January 27, 2011 20:32 — forked from bxjx/gist:583836
how to create data-uris for images in node.js
var express = require('express'),
request = require('request'),
BufferList = require('bufferlist').BufferList,
sys = require('sys');
var app = express.createServer(
express.logger(),
express.bodyDecoder()
);