Skip to content

Instantly share code, notes, and snippets.

View mfilej's full-sized avatar

Miha Filej mfilej

View GitHub Profile
@mfilej
mfilej / queens.pl
Created June 27, 2009 08:44
8 queens problem solver in prolog
solution([]).
solution([X/Y | Others]) :-
solution(Others),
member(Y, [1, 2, 3, 4, 5, 6, 7, 8]),
noattack(X/Y, Others).
noattack(_, []).
@mfilej
mfilej / dnsmasq.conf
Created August 21, 2009 14:25
dnsmasq config for our router
no-resolv
no-poll
bogus-priv
domain-needed
stop-dns-rebind
cache-size=2048
expand-hosts
local=/rezidenca/
server=213.143.65.11
server=213.143.65.12
@mfilej
mfilej / no_ads_please.css
Created August 23, 2009 20:14
grooveshark.com userstyles
#adBar { display: none !important }
#mainContentWrapper { margin-right: 0px !important }
@mfilej
mfilej / my.cnf
Created September 3, 2009 16:05
mysql config for os x
[client]
socket = /var/run/mysqld/mysqld.sock
user = root
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
[mysqld]
user = miha
datadir = /Users/miha/Library/Databases/mysql
@mfilej
mfilej / sample_output.txt
Created October 2, 2009 14:23
fetch next episode info from tvrage.com
Lie to Me episode 15: 2x02 -- Truth or Consequences is airing on 2009-10-05
Mad Men episode 34: 3x08 -- Souvenir is airing on 2009-10-04
The Big Bang Theory episode 43: 3x03 -- The Gothowitz Deviation is airing on 2009-10-05
@mfilej
mfilej / grid_overlay.js
Created October 11, 2009 18:14
toggle the visibility of a grid to aid setting the vertical rhythm
// depends on prototype and http://mislav.uniqpath.com/js/c-is-for-cookie/
document.observe('dom:loaded', function() {
var gridOverlay = $('grid-overlay')
if (!gridOverlay) return
if (Cookie.get('gridOverlay') == "true") gridOverlay.show()
var toggleGrid = function() {
var visible = this.toggle().visible()
Cookie.set('gridOverlay', visible, { path: '/' })
@mfilej
mfilej / now_playing.sh
Created October 17, 2009 17:46
get the current song from iTunes
#! /bin/sh
# mostly from http://www.macosxhints.com/article.php?story=2004070301135736
# using with GeekTool
if ps x \
| grep [/]Applications/iTunes.app/Contents/MacOS/iTunes \
> /dev/null; then
osascript - <<'OSASCRIPT'
@mfilej
mfilej / _.md
Created October 25, 2009 02:15
Copy public iDisk URL from Finder (automator action)

Copy public iDisk URL from Finder

iDisk is not the best user experience Apple has to offer and I hope that they are going to realize that in the near future. One of it's many flaws is the lack of a simple way to get the public URL for a file (without opening the web interface), preferably from the Finder.

This is a script for Automator. Create a new service and select "Service receives selected Files or folders in Finder". Add the "Run shell script" action from the library and insert the code from convert_path_to_idisk_url.rb. Save as "Copy public URL".

Open Finder, select a file, go to Finder ➞ Services ➞ Copy as public URL.

You have to wait for the script to execute, it can take a second or two. There is no feedback when the script is done.

class Array
def bump_duplicates!
current = max.succ
each_with_index do |element, i|
if slice(0...i).include? element
self[i] = current
current = current.succ
end
end
end
@mfilej
mfilej / chromium_update
Created March 19, 2010 10:48
chromium_update (forked from http://pastie.org/819162)
#!/usr/bin/env ruby
# Script for OS X users to install and run the latest nightly Chromium build
#
# Save as file as "chromium_update" in your $PATH; and chmod +x chromium_update
#
# Written by Dr Nic Williams and Bo Jeanes from Mocra; [email protected]
# Updated by Miha Filej (github.com/mfilej)
require "pathname"