Skip to content

Instantly share code, notes, and snippets.

View brgnepal's full-sized avatar

Budh Ram Gurung (BRG) brgnepal

View GitHub Profile
@brgnepal
brgnepal / gist:d1d8b8a6a6eca3036278
Created May 29, 2015 08:23
Split div into three equal parts: snippet 3
$('#main_div').width(800).height(500).split({
orientation: 'vertical',
limit: 3,
position: '67%'
});
$('#left_pane').width($('#left_pane').width()).height(500).split({
orientation: 'vertical',
limit: 3,
position: '50%'
});
@brgnepal
brgnepal / gist:4580c0c10c262a95f958
Last active August 29, 2015 14:22
Split div into three equal parts: snippet 2
<div id="main_div">
<div id="left_pane">
<div id="first_left_pane">
<!-- your left content goes here -->
</div>
<div id="second_left_pane">
<!-- your middle content goes here -->
</div>
</div>
<div id="right_pane">
@brgnepal
brgnepal / gist:6696ba586d780dad07c8
Created May 27, 2015 10:44
Setting database config params from config file in Sinatra
DB_CONFIG = YAML.load(File.open('config/database.yml'))
EXCEPTIONS = ['[email protected]', '[email protected]']
LDAP = Ldap.setup
set :public_folder, 'public'
db_config = <<END
mysql2://#{DB_CONFIG['username']}:\
#{DB_CONFIG['password']}@#{DB_CONFIG['host']}:\
#{DB_CONFIG['port']}/#{DB_CONFIG['database']}
END
{
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
],
"remember_open_files": false,
# github.com/GeertJohan/go.rice/rice
../../../../_work/gocode/src/github.com/GeertJohan/go.rice/rice/append.go:15: import /home/budhram/_work/gocode/pkg/linux_amd64/github.com/daaku/go.zipexe.a: object is [linux amd64 go1.3.1 X:precisestack] expected [linux amd64 go1.4.1 X:precisestack]
@brgnepal
brgnepal / README.md
Last active August 29, 2015 14:20 — forked from jonhoo/README.md

Distributed Read-Write Mutex in Go

The default Go implementation of sync.RWMutex does not scale well to multiple cores, as all readers contend on the same memory location when they all try to atomically increment it. This gist explores an n-way RWMutex, also known as a "big reader" lock, which gives each CPU core its own RWMutex. Readers take only a read lock local to their core, whereas writers must take all locks in order.

@brgnepal
brgnepal / gist:c3f702aa35b87d2f98d6
Created April 22, 2015 13:57
Supervisor build error
agrant@atlantis-aquarium-vm:~/repos/atlantis-supervisor$ time make build
Installing Dependencies...
# github.com/docker/docker/pkg/pools
vendor/src/github.com/docker/docker/pkg/pools/pools.go:30: undefined: sync.Pool
make: *** [install-deps] Error 2
real 31m5.002s
user 1m58.691s
sys 11m41.219s
cd ./data/supervisor; make -C /home/vagrant/repos/atlantis-supervisor/ clean deb
make: Entering directory `/home/vagrant/repos/atlantis-supervisor'
rm -rf bin pkg /home/vagrant/repos/atlantis-supervisor/lib/atlantis/src/atlantis/crypto/key.go
rm -f example/supervisor example/client example/monitor
Installing Dependencies...
done check
done toml
done gocheck
done aws
done s3
@brgnepal
brgnepal / gist:642775abdc3469cd9453
Created April 10, 2015 07:07
Answer for ADDREV challenge in SPOJ
cases = gets.chomp.to_i
def valid_numeric_input?(input)
input.zero?
end
def reverse_num(num)
num.to_s.reverse.to_i
end