This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Put this script in your PATH and download from onemanga.com like this: | |
# onemanga_downloader.rb Bleach [chapter number] | |
# | |
# You will find the downloaded chapters under $HOME/Documents/OneManga/Bleach | |
# | |
# If you run this script without arguments, it will check your local manga downloads | |
# and check if there are any new chapters | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Batch conversion from tga to jpg | |
# Author: Guilherme Garnier - http://blog.guilhermegarnier.com | |
# Adapted from: | |
# http://linux.strangegamer.com/index.php?title=Converting_A_directory_of_TGA%27s_To_JPG | |
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extracted from http://superuser.com/questions/56093/remove-audio-stream-from-xvid-files | |
# replace -aid value with the audio track number you wish to keep | |
mencoder orig.avi -o new.avi -oac copy -ovc copy -aid 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check-git-status.sh - Checks the status for all my git projects | |
# Usage: check-git-status.sh <main projects directory> | |
if [ -z "$1" ]; then | |
mainDir="$HOME/Projects" | |
else | |
mainDir="$1" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: http://javascript.crockford.com/private.html | |
Test = function() { | |
function private() { | |
return "private"; | |
} | |
return { | |
public: function() { | |
return private(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ordering a list by field1 in descending order. If two elements have the same value, order by field2 in ascending order | |
list.sort do |a, b| | |
comp = (b.field1 <=> a.field2) | |
comp.zero? ? (a.field2 <=> b.field2) : comp | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text.gsub(/<a href="([^"]*)">([^<]*)<\/a>/, '[\2](\1)') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir.glob("source/_posts/*.markdown").each do |filename| | |
formatted_date = filename.split("/").last[0..9] | |
puts "Adding date #{formatted_date} to file #{filename}" | |
lines = [] | |
IO.readlines(filename).map do |line| | |
lines << line | |
lines << "date: #{formatted_date}" if line =~ /^title: / | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Superclass | |
@@var1 = "var 1 Superclass" | |
@var2 = "var 2 Superclass" | |
def self.var1 | |
@@var1 | |
end | |
def self.var2 | |
@var2 |
OlderNewer