Skip to content

Instantly share code, notes, and snippets.

View indirect's full-sized avatar

André Arko indirect

View GitHub Profile
#!/usr/bin/ruby -w
require 'fileutils'
$pageBreakTag = /<hr>\s<A name=[0-9]+><\/a>/i
$brTag = /<br>/i
$bodyTag = /<body[^>]*>/i
$fileHeaderTag = /file.*<br>/i
def season(dn)
Dir.glob(dn+"/*").sort.each do |fn|
if fn=~/#{dn}\/.*?(\d+)x\d+.*?/
sdir = dn+"/#{dn} Season #{$1}"
FileUtils.mkdir_p(sdir)
FileUtils.mv(fn, sdir+"/")
end
end
end
#!/bin/sh -x
CURRENT=`git branch | grep "\*" | cut -d' ' -f2`
git checkout master
git svn info >/dev/null 2>/dev/null
if [[ $? == 0 ]]; then
git svn rebase
else
git pull origin master
fi
git checkout ${CURRENT}
@indirect
indirect / README
Created December 18, 2008 21:29
Update WebKit nightly
To use this:
1. check out the gist somewhere
2. edit the plist to contain the path to the .rb file
3. run this:
chmod +x update-webkit.rb
launchctl load com.indirect.update-webkit.plist
@indirect
indirect / autosorter.rb
Created December 19, 2008 00:46
TV Show file renamer and sorter
# TV show renamer/sorter script
# Call with directories to sort from and to:
# autosorter.rb 'Downloads/Completed' 'Video/TV Shows'
NAME_FORMATS = [
/^(.+?) S(\d\d)E(\d\d(?:-E\d\d)?)(.*?)(?: (?:\wDTV|PROPER|WS).*)? (...)$/i, # S00E00 format
/^(.+?) (\d?\d)x(\d\d(?:-\d\d)?)(.*?)(?: (?:\wDTV|PROPER|WS).*)? (...)$/i # 00x00 format
]
class String
fatal: Invalid revision range 0000000000000000000000000000000000000000..26890b460a9ef76cdcdc6fd75e597d3e5fe3a508
/var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/internal/pack.rb:171:in `[]': stack level too deep (SystemStackError)
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/internal/pack.rb:171:in `find_object_in_index'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/internal/pack.rb:159:in `find_object'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/internal/pack.rb:64:in `with_idx'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/internal/pack.rb:158:in `find_object'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/internal/pack.rb:125:in `[]'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/repository.rb:75:in `get_raw_object_by_sha1'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/repository.rb:74:in `each'
from /var/lib/gems/1.8/gems/grit-0.9.1/lib/grit/git-ruby/re
#!/usr/bin/env ruby
# Movie date search by filename
require 'rubygems'
require 'open-uri'
require 'cgi'
require 'hpricot'
files = Dir[File.join(ARGV[0], '*')]
unless files.any?
#!/usr/bin/ruby -w
require 'fileutils'
$pageBreakTag = /<hr>(\s<A name=[0-9]+><\/a>)?/i
$brTag = /<br>/i
$bodyTag = /<body[^>]*>/i
$fileHeaderTag = /file.*<br>/i
[core]
legacyheaders = false
excludesfile = /Users/<username>/.gitexclude
[repack]
usedeltabaseoffset = true
[color]
branch = auto
diff = auto
status = auto
[alias]
#!/usr/bin/env ruby
# The script that give you focus!
# Create a text file that contains sites want to give yourself
# access to only during certain times of day.
#
# The file will look like this:
# 12 news.ycombinator.com
# 11-13,19-21 twitter.com
#