Skip to content

Instantly share code, notes, and snippets.

View davorb's full-sized avatar
👋

Davor Babić davorb

👋
View GitHub Profile
@davorb
davorb / zshrc
Created July 21, 2011 11:39
zshrc
#!/bin/zsh
HISTFILE=~/.histfile
HISTSIZE=10000 # about a year's worth
SAVEHIST=10000
bindkey -e
# don't overwrite history
setopt APPEND_HISTORY
@davorb
davorb / DFStat.java
Created July 21, 2011 11:47
dfstat -- pop up message if and when server goes online
import java.net.*;
import java.io.*;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
public class DFStat {
@davorb
davorb / ctrlfix.sh
Created July 21, 2011 11:50
Swap ctrl and capslock
#!/bin/sh
setxkbmap -option ctrl:swapcaps%
#!/usr/bin/ruby1.9.1
# -*- coding: iso-8859-1 -*-
require 'icalendar'
require 'date'
include Icalendar
module Csv2Ical
def self.create_ical(input_file_name)
@davorb
davorb / copy.sh
Created October 17, 2011 16:19
Copy files when moving dir
#http://embraceubuntu.com/2006/01/29/move-home-to-its-own-partition/
#Now, Copy files over:
#Since the “/home” directory will have hardlinks, softlinks, files and nested directories, a regular copy (cp) may not do the job completely. Therefore, we use something #we learn from the Debian archiving guide:
cd /home/
find . -depth -print0 | cpio --null --sparse -pvd /mnt/newhome/
@davorb
davorb / rbn_1.9.rb
Created October 18, 2011 23:50
rubinius list 1.9 incompabilities
# http://www.codelord.net/2011/10/11/submitting-your-first-patch-to-rubinius/
bin/mspec tag --list fails -tx19 :ci_files
# bin/mspec -tx19 spec/ruby/core/string/squeeze_spec.rb
@davorb
davorb / modvsand.rb
Created October 19, 2011 00:46
mod vs and
# comparsion of most implementations
# https://gist.github.com/29e95a9efbd3d42326af
require "benchmark"
amount = 5_000_000
Benchmark.bm do |b|
b.report("MOD") do
amount.times do |i|
@davorb
davorb / gist:1298075
Created October 19, 2011 11:52
xmonad error message
Error detected while loading xmonad configuration file: /home/davor/.xmonad/xmonad.hs
xmonad.hs:16:8:
Could not find module `XMonad.Util.EZConfig':
Use -v to see a list of the files searched for.
Please check the file for errors.
@davorb
davorb / gist:1298085
Created October 19, 2011 11:57
xmonad ghci
[davor@athena .xmonad]\$ ghci -v xmonad.hs
GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Glasgow Haskell Compiler, Version 7.0.3, for Haskell 98, stage 2 booted by GHC version 7.0.3
Using binary package database: /usr/lib/ghc-7.0.3/package.conf.d/package.cache
Using binary package database: /home/davor/.ghc/i386-linux-7.0.3/package.conf.d/package.cache
package Cabal-1.10.1.0-6c3f90d5661e9007e416fd4d7fae69aa is unusable due to missing or recursive dependencies:
directory-1.1.0.0-95cc9241c454ad659291443824c9e1e2 process-1.0.1.5-99e45a86cf1678266024ae9c30d1f778
package X11-xft-0.3-47a2a6dc7b61253aea29e7295cf7e6db is unusable due to missing or recursive dependencies:
haskell98-1.1.0.1-0d7fcd30208df558c4f77ae4850f8f1a
package bin-package-db-0.0.0.0-d12732cacc0711ad6e8e527298caf36a is unusable due to missing or recursive dependencies:
@davorb
davorb / gist:1298632
Created October 19, 2011 15:29
rubinius gcd
[davor@athena rubinius]\$ irb
rbx-head :001 > 3.methods
=> ["~", "**", "==", "div", "%", "inspect", "to_f", "-@", "divmod", "===", "<=", "to_s", "&", "<=>", "<", "quo", "|", ">", "coerce", "fdiv", "*", "^", "taint", "__marshal__", "+", "divide", "<<", "zero?", "size", "modulo", "-", "/", ">>", ">=", "untaint", "singleton_methods", "tainted?", "frozen?", "freeze", "dup", "to_int", "chr", "bits", "ord", "upto", "round", "next", "pred", "to_i", "ceil", "floor", "[]", "even?", "downto", "truncate", "succ", "integer?", "odd?", "times", "prec_f", "prec", "prec_i", "nonzero?", "+@", "redo_compare", "eql?", "remainder", "initialize_copy", "step", "abs", "between?", "__fixnum__", "__show__", "irb_binding", "kind_of?", "equal?", "public_methods", "__extend__", "instance_variables", "is_a?", "__send__", "instance_variable_get", "nil?", "clone", "__nil__", "singleton_class", "respond_to?", "extend", "__method__", "to_a", "hash", "__id__", "__instance_of__", "__instance_variable_get__", "instance_variable_set", "enum_for