This file contains 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
sudo apt-get install build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev libqt4-dev | |
wget http://www.makemkv.com/download/makemkv-oss-1.9.0.tar.gz | |
wget http://www.makemkv.com/download/makemkv-bin-1.9.0.tar.gz | |
tar -xvf makemkv-oss-1.9.0.tar.gz | |
tar -xvf makemkv-bin-1.9.0.tar.gz | |
cd makemkv-oss-1.9.0/ | |
./configure | |
make | |
sudo make install |
This file contains 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
window.cancelRequestAnimFrame = ( function() { | |
return window.cancelAnimationFrame || | |
window.webkitCancelRequestAnimationFrame || | |
window.mozCancelRequestAnimationFrame || | |
window.oCancelRequestAnimationFrame || | |
window.msCancelRequestAnimationFrame || | |
clearTimeout | |
} )(); | |
for (var i = 1; i < 99999; i++) { |
This file contains 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
def rgb2hsl(r,g,b) | |
r´ = r.to_f / 255 | |
g´ = g.to_f / 255 | |
b´ = b.to_f / 255 | |
c_max = [r´, g´, b´].max | |
c_min = [r´, g´, b´].min | |
Δ = c_max - c_min | |
h = Δ.zero? ? 0 : (60 * case c_max | |
when r´ then ((g´ - b´) / Δ) % 6 | |
when g´ then ((b´ - r´) / Δ) + 2 |
This file contains 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
# merge all pdf files from a directory to a single pdf file | |
pdftk *.pdf cat output out.pdf | |
# reverse page order of a pdf file | |
PDFTK_PAGES=$(pdftk in.pdf dump_data | grep NumberOfPages | sed "s/^.*: //") | |
pdftk in.pdf cat $PDFTK_PAGES-1 output out.pdf | |
# Strip metadata in pdf | |
PDFTK_FILE=in.pdf | |
pdftk $PDFTK_FILE dump_data | sed -e 's/\(InfoValue:\)\s.*/\1\ /g' | pdftk $PDFTK_FILE update_info - output out.pdf |
This file contains 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
# switching identities in order to use multiple github accounts on one computer, you have to: | |
# add to ~/.ssh/config according to current github user: | |
Host github.com | |
IdentityFile ~/.ssh/<rsa_id_for_current_user> | |
# set git user globally or locally according to current github user: | |
git config --local user.name "My Name" |
This file contains 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
#reduce PDF size | |
#-dPDFSETTINGS | |
# /screen | |
# /ebook | |
# /printer | |
# /prepress | |
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -sOutputFile=out.pdf in.pdf |
This file contains 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
#Lookup Tables, http://en.wikipedia.org/wiki/Lookup_table | |
#Memoization, http://en.wikipedia.org/wiki/Memoization | |
require 'benchmark' | |
########################################################### | |
# Fibonacci number, http://en.wikipedia.org/wiki/Fibonacci_number | |
def fib(n) | |
n < 2 ? 1 : fib(n-2) + fib(n-1) | |
end |
This file contains 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
module One | |
def a(*) | |
puts 'One...' | |
super | |
end | |
end | |
module Two | |
def a(*) | |
puts 'Two...' |
This file contains 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 sh | |
# Rename all file in the current directory according to their file creation date | |
# For jpegs the file date will be set according to its EXIF data | |
# e.g. | |
# "20130628_014218.txt" not renamed | |
# "test.TXT" => "20130628_002938.txt" | |
# file extensions will be lower case | |
jhead -ft -dt -autorot -exonly -n%Y%m%d_%H%M%S *.[Jj][Pp][Gg] |
This file contains 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
require 'benchmark' | |
class Bunch | |
def self.mark(&block) | |
first = Bunch.realtime(&block) | |
vs = {:first => first} | |
class << vs | |
def vs(&block) |