Skip to content

Instantly share code, notes, and snippets.

View sandrods's full-sized avatar

Sandro Duarte sandrods

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.sync_movies</string>
<key>StartCalendarInterval</key>
<dict>
@sandrods
sandrods / gist:926459
Created April 18, 2011 23:00
file renamer
# Dir["*.{srt}"].each do |f|
#
# replace = "S4"
# por = "S04"
#
# File.rename(f, f.gsub(replace, por))
#
# end
# Dir["*.{srt}"].each do |f|
@sandrods
sandrods / .gitignore
Created October 13, 2010 03:29
Automate subtitles download
config.yml
downloaded.log
class BitArray
attr_accessor :array
def initialize(value = nil)
if value
@array = value.to_s(2).split('').map {|i| i.to_i}
else
@array = []
end
end
@sandrods
sandrods / merge pdf's
Created September 27, 2010 19:50
Merge PDF's
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH Untitled-2.pdf Untitled-2-1.pdf
@sandrods
sandrods / apps
Created March 30, 2010 19:11
Setup Rails apps on the production server as a git repo and creates the Apache virtual host.
#!/usr/bin/ruby
require 'fileutils'
require 'rubygems'
require 'commander/import'
require 'ostruct'
require 'yaml'
class AppSetuper
DEPLOY_TO = "/var/www"
@sandrods
sandrods / series.rb
Created February 10, 2010 23:47
Series scratcher & downloader
require 'rubygems'
require 'mechanize'
require 'rufus/scheduler'
require 'growl'
class Logger
def self.log(msg, title=nil, sticky=false, show_time=true)
time = show_time ? "\n#{Time.now.strftime('%a %d %b %H:%M')}" : ''
Growl.notify "#{msg}#{time}", :title=>title, :sticky=>sticky
on run {input, parameters}
tell application "Terminal"
activate
set p to (quoted form of POSIX path of (input as string))
set s to "if [ -d " & p & " ]; then cd " & p & "; else cd `dirname " & p & "`; fi"
if (the (count of the window) = 0) or (the busy of window 1 = true) then
do script s
else
do script s in window 1
PATH=/usr/local/bin:$PATH
alias ll="ls -l"
alias cd..="cd .."