Skip to content

Instantly share code, notes, and snippets.

View sdoro's full-sized avatar

Sandro Doro sdoro

View GitHub Profile
@sdoro
sdoro / gist:4002209
Created November 2, 2012 15:55
How can you calculate the number of days since 1/1/1970?
echo $((`date --utc --date "$1" +%s`/86400))
@sdoro
sdoro / gist:4003626
Created November 2, 2012 18:58
PostgreSQL Auto Increment
CREATE SEQUENCE mgr_id_seq;
CREATE SEQUENCE;
CREATE TABLE managers(
mgr_id INTEGER PRIMARY KEY DEFAULT NEXTVAL('mgr_id_seq'),
mgr_name VARCHAR(50),
mgr_email VARCHAR(50)
);
@sdoro
sdoro / gist:4006838
Created November 3, 2012 09:44
Generate ssh key without passphrase
ssh-keygen -q -b 2048 -f ~/.ssh/id_rsa -N ""
# add -C "comment" to insert comment in *.pub file
@sdoro
sdoro / gist:4009258
Created November 3, 2012 23:20
Debian squeeze-backports
cat /etc/apt/sources.list.d/backports.list
deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free
@sdoro
sdoro / gist:4009275
Created November 3, 2012 23:26
Install pacemaker/corosync from Debian backports
apt-get -t squeeze-backports install corosync pacemaker
@sdoro
sdoro / gist:4009341
Created November 3, 2012 23:40
snippet corosync.conf
interface {
member {
memberaddr: 192.168.1.3
}
member {
memberaddr: 192.168.1.4
}
ringnumber: 0
bindnetaddr: 192.168.1.3
mcastport: 4000
@sdoro
sdoro / gist:4010872
Created November 4, 2012 09:15
bash configuration ~/.bashrc
# History
export HISTCONTROL=ignoredups:erasedups
export HISTSIZE=50000
export HISTFILESIZE=50000
export HISTTIMEFORMAT="%F %T "
# alias
alias l='ls -la'
alias df='df -h'
@sdoro
sdoro / gist:4010971
Created November 4, 2012 09:57
SSH Key Setup - HA cluster
# we can share the SSH keys that the service uses
node1# cd /etc/ssh/
node1# mkdir BAK
node1# cp -p ssh_host_* BAK
node1# scp node2:/etc/ssh/ssh_host* .
@sdoro
sdoro / gist:4012185
Created November 4, 2012 14:54
Using ocf:heartbeat:symlink resource-agents for implement symlink (instead od drbdlinks)
crm configure primitive p_sym_test ocf:heartbeat:symlink \
params target="/mnt/drbd/etc/test" link="/etc/test" backup_suffix=".active"
@sdoro
sdoro / gist:4013881
Created November 4, 2012 21:35
drbd Debian 6.0.x version
# dmesg | grep drbd
[ 12.675157] drbd: initialized. Version: 8.3.7 (api:88/proto:86-91)
[ 12.675164] drbd: srcversion: EE47D8BF18AC166BE219757
[ 12.675167] drbd: registered as block device major 147
[ 12.675171] drbd: minor_table @ 0xefe98980