Skip to content

Instantly share code, notes, and snippets.

@andyhky
andyhky / devstack.rb
Created May 10, 2012 — forked from vishvananda/devstack.rb
Vagrant script for devstack
View devstack.rb
Vagrant::Config.run do |config|
sshdir = "#{ENV['HOME']}/.ssh/"
cachedir = (ENV['CACHEDIR'] or "#{ENV['HOME']}/cache/")
checkout = (ENV['COOKBOOKS'] or "#{ENV['HOME']}/openstack-cookbooks")
ip_prefix = (ENV['IP_PREFIX'] or "192.168.27.")
mac_prefix = (ENV['MAC_PREFIX'] or "080027027")
suffix = "100"
ip = "#{ip_prefix}#{suffix}"
config.vm.box = "oneiric"
config.vm.box_url = "http://images.ansolabs.com/vagrant/oneiric64.box"
View install-graphite-ubuntu-10.04.sh
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@andyhky
andyhky / .bashrc
Created Jan 20, 2012
Some bashrc functions for octopress and RVM
View .bashrc
function np {
cd ~/octopress/
bundle exec rake new_post["$1"] | cut -d: -f2 | xargs subl
cd -
}
function octo {
cd ~/octopress/
sudo ps aux | grep rackup | grep 4000 | awk '{print $2}' | xargs kill -9
bundle exec rake generate
nohup bundle exec rake preview > ~/octopress/andy.log &
@andyhky
andyhky / rd.sh
Created Jan 1, 2012
Remove duplicates via checksum
View rd.sh
#!/bin/bash
# rd - remove dupliactes
# http://nerdnotes.org/2008/12/remove-duplicate-files/
# find the files using the specified 'find arguments'
find "$@" -type f -print0 |
# calculate checksum for each file
xargs -0 -n1 md5sum |
@andyhky
andyhky / db-backup-removal.ps1
Created May 13, 2011
PowerShell Script for SQL Server Backup Removal
View db-backup-removal.ps1
param(
[string]$path,
[int]$days
)
# Recursively looks through a specified folder and deletes files of .bak and .trn extensions older than 30 days.
# USAGE: .\db-backup-removal.ps1 $path $days
# EXAMPLE: .\db-backup-removal.ps1 "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\" 30 -- prints all files in folder recursively to be removed
# Remove -whatif and it will actually delete the files
# http://stackoverflow.com/questions/314679/why-arent-my-sql-server-2005-backups-being-deleted