Skip to content

Instantly share code, notes, and snippets.

@simonc
simonc / iplist.rb
Created October 14, 2009 19:03
Extracts interfaces name and IP address from ifconfig
#!/usr/bin/env ruby
`ifconfig -a`.split(/\n[^\t]/).each do |iface|
name = iface.match(/^(.*?):/)[1]
match = iface.match(/inet ((\d+\.?){4})/)
if match
inet = match[1]
puts "#{name}\t#{inet}"
end
@simonc
simonc / tag_music.sh
Created October 14, 2009 19:06
Functions to add ID3 tags to mp3 files from their name
#!/usr/bin/env bash
tag_tracks ()
{
reg_name="s/^\([0-9]\{2\}\)___\(.*\)\.\(mp3\|ogg\)/\2/"
if [ -f ./Folder.jpg ]; then
img='./Folder.jpg'
else
if [ -f ../Folder.jpg ]; then
@simonc
simonc / commits_for
Created October 14, 2009 19:21
Call svn log for a specific user
#!/usr/bin/env bash
username=$1
options=$2
list=''
for r in `svn log | grep $username | sed 's/r\([0-9]\+\).*/\1/'`; do
list="$list -r$r"
done
@simonc
simonc / iSSH
Created October 14, 2009 19:35
Sets the remote hostname as iTerm background
#!/usr/bin/env bash
BG_COLOR="#000000" # Background color
FG_COLOR="#662020" # Foreground color
DIMENSIONS="570x342" # Console dimensions
GRAVITY="NorthEast" # Text gravity (NorthWest, North, NorthEast,
# West, Center, East, SouthWest, South, SouthEast)
OFFSET="20,10" # Text offset
FONT_SIZE="60" # Font size in points
FONT_FAMILY="Monaco" # Font family
*.swp
.DS_Store
.sass-cache
config/database.yml
db/schema.rb
log/*
public/stylesheets/*.css
tmp/*
@simonc
simonc / subversion-unicode-path.patch
Created June 11, 2010 12:27
Subversion Unicode Path Patch
diff --git a/subversion/libsvn_subr/path.c b/subversion/libsvn_subr/path.c
===================================================================
--- a/subversion/libsvn_subr/path.c
+++ b/subversion/libsvn_subr/path.c
@@ -35,6 +35,10 @@
#include "private_uri.h"
+#if defined(DARWIN)
+#include <CoreFoundation/CoreFoundation.h>
@simonc
simonc / commit-msg.rb
Created July 20, 2010 14:49
commit-msg
#!/usr/bin/env ruby
file = ARGV.first
branch = `git br --no-color | grep '^*' | cut -d' ' -f2`.gsub(/ref-(\d+)-.*/, '\1').strip
open('/tmp/git_debug', 'a') { |f| f.puts branch }
msg = ''
if branch =~ /^\d+$/s
@simonc
simonc / human.rb
Created September 9, 2011 17:41
Human DNA
class Human
attr_reader :smart
def initialize
@smart = (rand == rand)
end
end
@simonc
simonc / devise.fr.yml
Last active October 3, 2015 08:38
French translation of devise.en.yml
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
fr:
devise:
confirmations:
confirmed: 'Votre compte a été validé.'
send_instructions: 'Vous allez recevoir les instructions nécessaires à la confirmation de votre compte dans quelques minutes.'
send_paranoid_instructions: 'Si votre e-mail existe dans notre base de données, vous allez bientôt recevoir un e-mail contenant les instructions de confirmation de votre compte.'
failure:
already_authenticated: "Vous êtes déjà connecté !"
@simonc
simonc / README.md
Created May 25, 2012 10:41
find_each with ActiveResource

This is an example implementation of find_each with ActiveResource

Dependencies:

API:

  • has_scope

Client: