Skip to content

Instantly share code, notes, and snippets.

@bonyiii
bonyiii / gist:872495
Created March 16, 2011 13:34
download railscasts
wget -q -O - http://feeds.feedburner.com/railscasts | awk -F \” ‘/media:content/ {print $4}’ | head -n 2 | wget -i - -c
credit: http://niczsoft.com/2010/01/download-all-railscasts/
@bonyiii
bonyiii / gist:884681
Created March 24, 2011 06:57
How to create diff file for gentoo ebuild patch

An example to patch unixODBC-2.3.0 on a 64bit machine to work with oracle 8.

First download unixODBC source. mkdir /tmp/unixODBC/source

Create two new folder. mkdir /tmp/unixODBC/patch/original mkdir /tmp/unixODBC/patch/unixODBC-2.3.0/DriverManager/

cp /tmp/unixODBC/source/unixODBC-2.3.0/DriverManager/SQLConnect.c /tmp/unixODBC/patch/original

@bonyiii
bonyiii / gist:890073
Created March 28, 2011 06:26
Nagios setup

/etc/portage/package.use fájl tartalma media-libs/gd jpeg png net-analyzer/nagios-core apache2 vim-syntax net-analyzer/nagios-plugins mysql postgres ldap nagios-ssh nagios-ping nagios-dns net-analyzer/nagios-nrpe -ssl net-analyzer/nagios-plugins -ssl dev-lang/php apache2 xml gd

Telepítés: emerge -gkav nagios apache nagios-nrpe

@bonyiii
bonyiii / gist:926930
Created April 19, 2011 06:54
corosync pacemaker in openvz

According this [thread][pacemaker mail archive] setting up [/dev/shm][/dev/shm] solves these kind of problems:

Apr 19 06:18:27 mongo2.example.com crmd: [1938]: info: crm_timer_popped: Wait Timer (I_NULL) just popped!
Apr 19 06:18:28 mongo2.example.com crmd: [1938]: info: do_cib_control: Could not connect to the CIB service: connection failed
Apr 19 06:18:28 mongo2.example.com crmd: [1938]: WARN: do_cib_control: Couldn't complete CIB registration 29 times... pause and retry
Apr 19 06:18:30 mongo2.example.com crmd: [1938]: info: crm_timer_popped: Wait Timer (I_NULL) just popped!
Apr 19 06:18:31 mongo2.example.com crmd: [1938]: info: do_cib_control: Could not connect to the CIB service: connection failed
Apr 19 06:18:31 mongo2.example.com crmd: [1938]: WARN: do_cib_control: Couldn't complete CIB registration 30 times... pause and retry
Apr 19 06:18:31 mongo2.example.com crmd: [1938]: ERROR: do_cib_control: Could not complete CIB registration  30 times... hard error
Apr 19 06:18:31 mongo2.example.com 
@bonyiii
bonyiii / gist:951412
Created May 2, 2011 10:22
Trac with Apache WSGI

WSGI install under opensuse 11.1

http://rpm.pbone.net/index.php3/stat/4/idpl/11536618/dir/opensuse/com/apache2-mod_wsgi-2.3-1.5.x86_64.rpm.html

If receiving this error:

 TimeoutError: Unable to get database connection within 0 seconds. (TracError(<babel.support.LazyProxy object at 0x7f75bbba7b90>,))

Make sure the user running the web server has read access to trac.ini.

@bonyiii
bonyiii / gist:953031
Created May 3, 2011 08:52
show all foreign key in a database
@bonyiii
bonyiii / gist:954781
Created May 4, 2011 05:03
speed up ssh connection with X forward
@bonyiii
bonyiii / gist:964082
Created May 10, 2011 08:09
message over ssh
http://ranjith.zfs.in/send-messages-over-network-gnome-popup-box-message/
http://unix.stackexchange.com/questions/9153/xmessage-over-ssh
http://en.andregondim.eti.br/?p=72
xmessage "Hello World!" -display :0 &
Start desktop application over ssh on a remote machine
# DISPLAY=:0; XAUTHORITY=~owner_of:0/.Xauthority; export DISPLAY XAUTHORITY
@bonyiii
bonyiii / gist:969354
Created May 12, 2011 20:19
routing overlapping local networks via vpn
http://www.systola.org/howto/overlap/overlap-en.cfm
####
http://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/openvpn-routing-where-local-and-remote-networks-clash-583809/
####
http://openvpn.net/index.php/open-source/faq/77-server/321-remap-local-addresses-to-connect-two-networks-with-an-overlap-in-the-private-address-range.html
@bonyiii
bonyiii / gist:970337
Created May 13, 2011 10:49
forcibly kill idle postgresql process
http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE
http://www.postgresql.org/docs/current/static/monitoring-stats.html#MONITORING-STATS-VIEWS
http://stackoverflow.com/questions/727194/force-client-disconnect-using-postgresql
SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
pg_stat_get_backend_activity(s.backendid) AS current_query
FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;