Skip to content

Instantly share code, notes, and snippets.

View jjoergensen's full-sized avatar

jjoergensen

  • Copenhagen, Denmark
View GitHub Profile
### Keybase proof
I hereby claim:
* I am jjoergensen on github.
* I am jjoergensen (https://keybase.io/jjoergensen) on keybase.
* I have a public key ASC92xNxRMxxUq8FDeWdilxa02qnyPoZ2zduHCzu1DynQAo
To claim this, I am signing this object:
@jjoergensen
jjoergensen / 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.

@jjoergensen
jjoergensen / s3.sh
Last active August 29, 2015 14:20 — forked from chrismdp/s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
If you see the error message below, you may need this patch:
Undefined symbols for architecture x86_64:
"_tun_close", referenced from:
_tuntap_open in n2n.a(tuntap_osx.o)
ld: symbol(s) not found for architecture x86_64
# How to use
If you got the source code from official repository, like me:
svn co https://svn.ntop.org/svn/ntop/trunk/n2n
# ...
include "dynamic_backends.vcl";
# ...
@jjoergensen
jjoergensen / qemu
Last active December 25, 2015 05:29
Qemu port forwarding script
#!/bin/bash
#
# ZYV
#
# This horrible script adds and removes iptables rules to allow for port
# forwarding from the host machine (virtualization server) to the selected
# virtualized guests.
#
# Unfortunately, libvirt inserts its own FORWARD rules along with final REJECTs
# at the very top of the table, so the rules defined via iptables config will
@jjoergensen
jjoergensen / postgresql_backup_and_restore.sh
Created December 6, 2011 15:23
Verify that postgresql has started
pg_dump -Upostgres --format=c --file=testdb_backup.sqlc testdb
pg_restore -Upostgres --verbose --format=c testdb_backup.sqlc
# create user and set password
sudo useradd -m postgres
sudo passwd postgres
cd ~/
# download from my dropbox or http://www.openscg.org/se/postgresql/packages.jsp
wget http://dl.dropbox.com/u/2029337/Software/postgres_9.1.1-1.amd64.openscg.deb
sudo dpkg -i postgres_9.1.1-1.amd64.openscg.deb
sudo /etc/init.d/postgres-9.1-openscg start