Skip to content

Instantly share code, notes, and snippets.

View tovbinm's full-sized avatar
⌨️
<typing sounds>

Matthew Tovbin tovbinm

⌨️
<typing sounds>
View GitHub Profile
@tovbinm
tovbinm / mass_alarms.rb
Created December 7, 2012 19:57
Mass Alarms - a tool for creating/updating a large amount of AWS CloudWatch metric alarms
require 'rubygems'
require 'aws-sdk'
puts "\nLoading instances..."
if File.exist?('instances.yaml')
instances_by_id = YAML.load_file('instances.yaml')
puts "Loaded %d instances from instances.yaml" % [instances_by_id.count]
else
instances_by_id = Hash.new
ec2 = AWS::EC2.new
@tovbinm
tovbinm / gist:4220948
Created December 6, 2012 00:49
Setup Amazon CloudWatch for Debian
1. Install all the required libraries:
sudo apt-get update && sudo apt-get -y install \
unzip \
perl \
wget \
curl \
make \
ncftp \
liburi-perl \
@tovbinm
tovbinm / gist:4157917
Created November 27, 2012 23:25
Debian Squeeze Virtual Machine
http://virtual-machine.org/debian-6-amd64-x86_64-vmware-image-download
@tovbinm
tovbinm / setup_ec2.sh
Created November 2, 2012 19:03
Install EC2 command line tools
#!/bin/bash
EC2_DIR=/usr/local/ec2
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip -O ec2-api-tools.zip
wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip -O ec2-ami-tools.zip
mkdir -p $EC2_DIR
rm -rf $EC2_DIR/*
unzip -o -d $EC2_DIR ec2-api-tools.zip
unzip -o -d $EC2_DIR ec2-ami-tools.zip
cp -r $EC2_DIR/ec2-api-tools*/* $EC2_DIR
cp -r $EC2_DIR/ec2-ami-tools*/* $EC2_DIR
@tovbinm
tovbinm / gist:3977493
Created October 30, 2012 00:07
Unattended Java installation on Debian
echo "sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive aptitude install -y -f sun-java6-jre sun-java6-bin sun-java6-jdk
@tovbinm
tovbinm / Output
Last active October 27, 2015 21:46
Unique paths
Some tests...
Number of unique paths from (0,0) to (0,0) on board of size 1x1 is 1
Number of unique paths from (0,0) to (1,1) on board of size 2x2 is 2
Number of unique paths from (0,0) to (2,2) on board of size 3x3 is 12
Number of unique paths from (0,0) to (3,3) on board of size 4x4 is 184
Number of unique paths from (0,0) to (4,4) on board of size 5x5 is 8512
@tovbinm
tovbinm / gist:3763987
Created September 21, 2012 21:23
MacOSX port tweaks
sudo vim /etc/sysctl.conf
#Increase ephemeral port range
net.inet.ip.portrange.first=32768
#Decrease closing timeout
net.inet.tcp.msl=1000
@tovbinm
tovbinm / Disable
Created July 12, 2012 07:06
SSD Trim Support on Mac OS Lion - For non SandForce 2 controllers ONLY!!! - Check here - http://en.wikipedia.org/wiki/SandForce#SSDs
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x41\x50\x50\x4C\x45\x20\x53\x53\x44$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
@tovbinm
tovbinm / gist:2993133
Created June 26, 2012 03:41
Set Useragent in Firefox on Linux
Add "user_pref("general.useragent.override", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1");"
to prefs file: /usr/lib/firefox/defaults/pref/channel-prefs.js
@tovbinm
tovbinm / gist:2990642
Created June 25, 2012 19:15
Fixing Home, End, Page Up, and Page Down in Leopard’s Terminal
Terminal -> Preferences -> Settings -> Keyboard tab
Home - \001 (or press Ctrl+a)
End - \005 (or press Ctrl+e)
Page Up - \033[5~
Page Down - \033[6~