Skip to content

Instantly share code, notes, and snippets.

@omribahumi
omribahumi / pre-commit
Created February 24, 2013 13:26
pre-commit git hook to make sure developers don't accidentally commit code they didn't mean to commit :)
#!/bin/sh
# pre-commit git hook to make sure developers don't accidentally commit code they didn't mean to commit :)
REMOVEME_STRING="REMOVEME"
ALLOW_COMMITTING_REMOVEME=`git config hooks.allowcommittingremoveme`
# redirect stdout to stderr
exec 1>&2
if [ "$ALLOW_COMMITTING_REMOVEME" != "true" ] &&
@omribahumi
omribahumi / Vagrantfile
Last active December 17, 2015 02:29
Ubuntu cloud image for vagrant doesn't work with SMP
Vagrant::Config.run do |config|
%w{20130425 20130429 20130502 20130506}.each do |date|
config.vm.define "ubuntu-#{date}" do |vm|
vm.vm.box = "ubuntu-#{date}"
vm.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/#{date}/precise-server-cloudimg-amd64-vagrant-disk1.box"
vm.vm.customize ["modifyvm", :id, "--cpus", 4]
vm.vm.host_name = "ubuntu-#{date}"
end
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ `which gsed` ]; then
alias sed='gsed'
fi
alias ls='ls -G'
alias grep='grep --color'
@omribahumi
omribahumi / udp_ip_pktinfo.go
Last active April 9, 2024 06:09
IP_PKTINFO usage in Go
package main
import (
"bytes"
"encoding/binary"
"fmt"
"net"
"syscall"
)
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise-server-cloudimg-amd64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :private_network, ip: "172.16.0.2", netmask: "255.255.255.0"
config.vm.provision :shell do |shell|
@omribahumi
omribahumi / gist:5dd14b8522022b28c34e
Created November 20, 2014 18:49
Cloudformation metadata API Ruby code
require 'net/http'
require 'base64'
require 'json'
module Cfn
class << self
def instance_identity_document()
Net::HTTP.get(URI('http://169.254.169.254/latest/dynamic/instance-identity/document'))
end