Skip to content

Instantly share code, notes, and snippets.

@domwom
domwom / .vimrc
Created May 11, 2010 09:43
becoming root within vim
# becoming root within vim
cmap w!! %!sudo tee > /dev/null %
@domwom
domwom / ssh tar
Created April 26, 2010 08:41
ssh tar rsync
## From the server
# Untar at destination
tar -czf - /some/file | ssh host.name tar -xzf - -C /destination
# Save as tarball
tar -czpv /path/to/stuff/that/we/backup | ssh user@backup.server "dd of=/path/to/where/my/backup/goes/on/the/server/backup.tar.gz"
## From Remote
ssh remoteuser@my.client.that.needs.a.backup "tar cvpz  /path/to/backup"  > ./remoteclient-backup.tar.gz
@domwom
domwom / curl vs. wget
Created April 5, 2010 12:43
curl vs. wget
# get headers
curl -D - -o /dev/null http://example.net/
@domwom
domwom / gist:213542
Created October 19, 2009 17:45
php bitly api
function make_bitly_url($url, $login, $appkey, $format='xml', $history=1, $version='2.0.1')
{
//create the URL
$bitly = 'http://api.bit.ly/shorten';
$param = 'version='.$version.'&longUrl='.urlencode($url).'&login='
.$login.'&apiKey='.$appkey.'&format='.$format.'&history='.$history;
//get the url
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $bitly . "?" . $param);
## some dummy data
x <- seq(as.Date("2008-01-01"), as.Date("2009-10-31"), by = "day")
set.seed(1234)
y <- cumsum(rnorm(length(x)))
## plot, but suppress axes
plot(y ~ x, type = "l", axes = FALSE)
## add in axis on side 2
axis(2)
@domwom
domwom / no_follow_back.rb
Created August 16, 2009 15:27 — forked from jerodsanto/no_follow_back.rb
no_follow_back.rb
require 'rubygems'
require 'twitter'
auth = Twitter::HTTPAuth.new('username', 'password')
base = Twitter::Base.new(auth)
guilty = base.friend_ids - base.follower_ids
puts "There are #{guilty.size} People you follow who do not follow you"
guilty.each do |user_id|
/*
* Twita@talinkahashifyer
* http://www.dustindiaz.com
* http://www.dustindiaz.com/basement/ify.html
*
* Copyright (c) 2009 Dustin Diaz
* licensed under public BSD
*/
var ify = function() {
return {
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
@domwom
domwom / base_template.rb
Created May 9, 2009 21:54
rails_templates
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
gitignoreItems = %w(
.DS_Store
log/*.log
@domwom
domwom / gist:109371
Created May 9, 2009 18:48
bash profile
export TERM=xterm-color
export LSCOLORS=dxfxcxdxbxegedabagacad
alias ls='ls -G'
alias ll='ls -l'
alias l='ls -la'
alias la='ls -a'
alias gs='git status'
# tweak bash tab completion