Skip to content

Instantly share code, notes, and snippets.

@ecarnevale
ecarnevale / gist:1884033
Created February 22, 2012 10:24
put in your ~/.profile
function _ssh_completion() {
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
#!/usr/bin/python
#builtin
import re, shutil, json, urllib2, os, sys
from string import Template
from subprocess import call
#external
import netifaces
12096 dotadmin 20 0 62208 40m 3036 S 0.0 1.0 0:31.08 ruby
13249 dotadmin 20 0 61916 40m 3052 S 0.0 1.0 0:04.09 ruby
13244 dotadmin 20 0 53200 33m 3556 S 0.0 0.8 0:02.10 ruby
10735 mysql 20 0 134m 23m 3664 S 0.0 0.6 50:41.22 mysqld
10547 root 20 0 22096 9596 1516 S 0.0 0.2 7:29.37 ruby
2530
[user]
name = Emanuel Carnevale
email = my_email_not_here_for_spammers
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
@ecarnevale
ecarnevale / .git-completion.bash
Created August 1, 2011 16:41
source ~/.git-completion.bash
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
def create
soap_request = request.env['rack.input'].read
filename = "#{Time.now.iso8601(6)}_#{request.env['REMOTE_ADDR']}.txt"
File.open("#{Rails.root}/soap_requests/#{filename}", 'w') {|f| f.write(soap_request)}
Station.parse_xml(soap_request)
request.format = "soap"
render :layout => false
end
#!/usr/bin/env ruby
require 'mail'
# source = 'archives/2005-11.txt'
# month = 11
# year = 2005
#
# system "perl -ne 'if(/^From /){open F,\">eml/msg-#{year}-#{month}-\".++$m.\".eml\"}print F' #{source}"
@ecarnevale
ecarnevale / gist:999654
Created May 31, 2011 00:02 — forked from RobSpectre/gist:999620
Tagging an object on FluidINFO
fluidDB.put({
url: 'about/' + encodeURIComponent(sender.tab.url) + '/jeterfilter/contains-jeter',
payload: Math.round(((new Date()).getTime()-Date.UTC(1970,0,1))/1000),
async: false,
primitive: true,
username: fluidDBUsername,
password: fluidDBPassword,
success: function(json) {
console.log('URI tagged as containing Jeter.');
}
fsssss:fluidinfo_work emanuel$ time python match_itunes_musicbrainz.py ~/Music/iTunes/iTunes\ Music\ Library.xml
This will take a while. Try `tail -f match_itunes_musicbrainz.log`
Could not match 1635 tracks, 25.94% of your library.
2717 exact matches, 1952 inferred matches
Would you like to see the list of inferred matches?
Traceback (most recent call last):
File "match_itunes_musicbrainz.py", line 150, in <module>
main()
File "match_itunes_musicbrainz.py", line 79, in main
answer = prompt or raw_input("[Y/n] ")
@ecarnevale
ecarnevale / gist:999554
Created May 30, 2011 22:11
an Exception
INFO:root:Track: 会いたい人
INFO:root:Artist: 矢井田瞳 (Yaida Hitomi)
INFO:root:Album: i/flancy
DEBUG:<class 'musicbrainz2.webservice.WebService'>:GET http://musicbrainz.org/ws/1/track/?artist=%E7%9F%A2%E4%BA%95%E7%94%B0%E7%9E%B3%E3%80%80%28Yaida+Hitomi%29&type=xml&title=%E4%BC%9A%E3%81%84%E3%81%9F%E3%81%84%E4%BA%BA
DEBUG:<class 'musicbrainz2.webservice.WebService'>:GET http://musicbrainz.org/ws/1/track/?artist=%E7%9F%A2%E4%BA%95%E7%94%B0%E7%9E%B3%E3%80%80%28Yaida+Hitomi%29&type=xml&title=
DEBUG:<class 'musicbrainz2.wsxml.MbXmlParser'>:ExpatError: no element found: line 1, column 0
WARNING:root:MusicBrainz raised exception: no element found: line 1, column 0
WARNING:root:Could not find match!