Skip to content

Instantly share code, notes, and snippets.

View strika's full-sized avatar

Nebojša Stričević strika

View GitHub Profile
@strika
strika / db_setup_test.rb
Created September 3, 2014 14:07
Database setup debugger
require "yaml"
ROOT = File.expand_path('..', File.dirname(__FILE__))
puts "Project root: #{ROOT}"
db_file = File.join(ROOT, "config", "database.yml")
puts "database.yml path: #{db_file}"
db_configuration = YAML.load_file(db_file)
puts "Database configuration:"
@strika
strika / pds-remover.sh
Created December 6, 2013 07:19
Bash script for removing all PSD files from a repo history.
#!/bin/bash
set -o errexit
git filter-branch --tree-filter "git rm -r -f --ignore-unmatch *.psd" HEAD
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
@strika
strika / ssh-config
Last active April 25, 2016 14:12
.ssh/config
Host devbox
Hostname localhost
Port 2222
User strika
ForwardX11 yes
ForwardX11Trusted yes
ForwardAgent yes
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
@strika
strika / uninstall-gems
Created October 22, 2013 05:13
Uninstall all ruby gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
@strika
strika / random-token
Created October 6, 2013 05:32
Generating a random token in Ruby
def generate_token
token = Digest::SHA1.hexdigest([Time.now, rand].join)
end
@strika
strika / install-git
Created October 2, 2013 08:16
Latest Git on Ubuntu
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
class NullObject
def nil?; true; end
def !; true end
def to_a; []; end
def to_s(*args); ""; end
def to_str(*args); ""; end
def to_f(*args); 0.0; end
def to_i(*args); 0; end
def method_missing(*args, &blk)
self
@strika
strika / vbox-port-forwarding
Created April 4, 2013 17:19
VirtualBox port forwarding
VBoxManage modifyvm "mybox" --natpf1 "rails,tcp,,3000,,3000"
VBoxManage modifyvm "mybox" --natpf1 "guestssh,tcp,,2222,,22"