Skip to content

Instantly share code, notes, and snippets.

@roktas
roktas / gist:660999
Created November 3, 2010 11:50
fitpdf
#!/bin/sh
for f; do
[ -f $f ] || continue
gs -sOutputFile=$f.new \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 $f </dev/null && mv $f.new $f
done
@roktas
roktas / inoticoming
Created November 4, 2010 18:09
inoticoming
inoticoming --logfile t.log --pid-file t.pid /tmp/t --suffix .txt --stderr-to-log /tmp/t.sh {} \;
@roktas
roktas / pdf-ufalt
Created November 4, 2010 22:26
pdf ufalt
#!/bin/bash -e
# pdf içeriğinin ghostscript yorumlayıcı tarafından yeniden üretilmesi
# (derlenmesi) yoluyla pdf dosya boyutunu ufaltmaya çalış
# XXX kabuk matematiğinden dolayı bash gerekiyor
# XXX isimlerde boşluk kullanılabilir, tırnaklamaya dikkat
# yüzde olarak minimum sıkıştırma oranı
RATIO="20.0"
#!/bin/bash
# PDF dosyayı ghostscript yorumlayıcı ile yeniden üret.
# XXX isimlerde boşluk kullanılabilir, tırnaklamaya dikkat
PROGNAME="${0##*/}"
declare -A DICT=(
["producer"]="$PROGNAME"
@roktas
roktas / k.sh
Created November 14, 2010 12:29
wget --no-check-certificate -O- https://github.com/ecylmz/ecylmz.github.com/raw/HEAD/9/_posts/2010-11-14-kramdown.md |
sed -e '1,/^---/d' |
kramdown -o latex --template document >/tmp/kramdown.tex && pdflatex /tmp/kramdown.tex && evince /tmp/kramdown.pdf
@roktas
roktas / jp
Created November 14, 2010 13:55
#!/bin/bash
# Jekyll girdilerinden pdf üret.
# Örnek: <betik> 9/_posts/2010-11-14-kramdown.md
PATH=/var/lib/gems/1.8/bin:$PATH
[ $# -gt 0 ] || {
echo >&2 "Kullanım: $0 <jekyll markdown dosyası>"
echo >&2 "Örnek: $0 9/_posts/2010-11-14-kramdown.md"
# İzin verilen resim boyutları
SIZES = [640, 480]
# Slaytları resim gömerek üret.
rule '.html' => ['.md'] do |f|
sh "landslide -t themes/default #{f.source} -i -d #{f.name}"
end
desc "Resimleri boyutlandır ve optimize et"
task :optim do
def prep_rules_for_noext(sources, &process)
sources.each do |f|
rule f.pathmap("%X") => f do |t|
process.call(t)
end
end
end
# örnek bir kural: tüm .t uzantıları için bir şey yap
prep_rules_for_noext(FileList["**/*.t"]) do |t|
def prep_rules_for_noext(sources, &process)
sources.each do |f|
rule f.pathmap("%X") => f do |t|
process.call(t)
end
end
end
prep_rules_for_noext(FileList["**/*.t"]) do |t|
touch(t.name)
# A unicode character →
def prep_rules_for_noext(sources, &process)
sources.each do |f|
rule f.pathmap("%X") => f do |t|
process.call(t)
end
end
end
prep_rules_for_noext(FileList["**/*.t"]) do |t|