Skip to content

Instantly share code, notes, and snippets.

View mfilej's full-sized avatar

Miha Filej mfilej

View GitHub Profile
# TODO: switch to thetvdb.com API
require 'open-uri'
require 'hpricot'
BASE_URI = 'http://www.tvrage.com/'
NEXT_EPISODE_SELECTOR = '#iconn2 > td:first-child > table > tr + tr > td + td > span'
def show_uri(name)
"#{BASE_URI}#{name}"
@mfilej
mfilej / fluid-live_timing.css
Created August 24, 2010 22:42
formula1.com live timing fluid userstyles
html {
overflow: hidden;
}
#liveTimingsApplet {
position: absolute !important;
top: 0;
left: -27px;
}
@mfilej
mfilej / DebugConfirmTossingUnsubmittedFormText.markdown
Created September 11, 2010 16:02
Get rid of Safari's irritating "Are you sure you want to close this window?" prompt

prompt

Does it look familiar? It is especially annoying with Google Instant because google reloads the results without actually submitting the form and Safari thinks you are about to throw away the input.

To get rid of the prompt open up Terminal and enter the following command:

defaults write com.apple.Safari DebugConfirmTossingUnsubmittedFormText -bool FALSE

Restart safari and reclaim your sanity.

@mfilej
mfilej / gist:588475
Created September 20, 2010 19:17
Move the newest screen grab (png file) from the desktop to Dropbox (LaunchBar action)
#! /usr/bin/ruby
require "pathname"
require "fileutils"
require "uri"
def large_type(string)
msg = URI.encode(string)
system "open x-launchbar:large-type?string=#{msg}"
end
@mfilej
mfilej / gist:784300
Created January 18, 2011 11:28
mencoder: avi to dvd video with hard subs
mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf harddup -lavcopts aspect=16/9:vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=4281:keyint=15:vstrict=0 -ofps 25 -sub BlackCatWhiteCat.srt -subalign 2 -subpos 100 -subcp utf-8 -o dvdsub.mpg crna.avi
@mfilej
mfilej / n1.prolog
Created June 15, 2011 12:20
PPJ izpit 2011-03-30
% Napišite predikat linked(Node1, Node2, Path), ki drži takrat, ko med
% vozliščema Node1 in Node2 nekega grafa obstaja pot Path. Poskrbite tudi, da
% se vaš program nekako izogne neskončnemu ciklanju. Povezave med vozlišči v
% grafu so podane s predikatom link(Node1, Node2), ki pove, da obstaja
% povezava med vozliščema Node1 in Node2. Smer povezave določa vrstni red
% vozlišč v predikatu link/2, v danem primeru je povezava od vozlišča Node1 do
% vozlišča Node2.
%
% Primer grafa in njegovega zapisa v prologu je podan spodaj.
%
@mfilej
mfilej / Character Viewer.scpt
Created June 19, 2011 09:26
Open OS X's Character Viewer via AppleScript (10.6)
tell application "Finder"
open item "System:Library:Input Methods:CharacterPalette.app" of the startup disk
end tell
@mfilej
mfilej / Gemfile
Created July 4, 2011 11:52
inspect-headers.herokuapp.com – prints HTTP request headers (an excuse to try out heroku cedar)
source :rubygems
gem "rack", "~> 1.3.0"
gem "thin", "~> 1.2.7"
@mfilej
mfilej / mkv2m4v.sh
Created December 28, 2011 10:22
mkv to m4v
# demux
mkvextract tracks ${BASE}.mkv 1:${BASE}.ac3 2:${BASE}.264
# convert audio
ffmpeg -i ${BASE}.ac3 -acodec libfaac -ab 576k ${BASE}.aac
# or
ffmpeg -i ${BASE}.ac3 -vn -r 30000/1001 -acodec libfaac -ac 6 -ar 48000 -ab 448k ${BASE}.aac
# mux
MP4Box -add ${BASE}.264:fps=23.976 -add ${BASE}.aac ${BASE}.m4v
@mfilej
mfilej / gist:1527529
Created December 28, 2011 10:44
mp4box install log
==> Downloading http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz
File already downloaded in /Users/miha/Library/Caches/Homebrew
/usr/bin/tar xf /Users/miha/Library/Caches/Homebrew/gpac-0.4.5.tar.gz
==> chmod +x configure
chmod +x configure
==> ./configure --disable-wx --prefix=/usr/local/Cellar/gpac/0.4.5 --mandir=/usr/local/Cellar/gpac/0.4.5/share/man --extra-ldflags=-L/usr/X11/lib --use-ffmpeg=no --use-openjpeg=no
./configure --disable-wx --prefix=/usr/local/Cellar/gpac/0.4.5 --mandir=/usr/local/Cellar/gpac/0.4.5/share/man --extra-ldflags=-L/usr/X11/lib --use-ffmpeg=no --use-openjpeg=no
** System Configuration