Skip to content

Instantly share code, notes, and snippets.

@pyrat
pyrat / hostname.sh
Last active October 13, 2015 13:38
Changing the hostname
sudo hostname [hostname]
Edit entry in /etc/hosts
mo: (cb) ->
@getNewMOs((err, mos) =>
results = []
if mos.length > 0
mos.forEach (item) =>
@fwdToKannel(item, (err, result) ->
if err
logger.error "Error forwarding to kannel"
results.push result
if results.length == mos.length
@pyrat
pyrat / gist:4175463
Created November 30, 2012 12:19
CIDR Calculation
The number of addresses of a subnet defined by the mask or prefix can be calculated as 2address size - prefix size, in which the address size for IPv6 is 128 and 32 for IPv4. For example, in IPv4, a prefix size of /29 gives: 232-29 = 23 = 8 addresses.
@pyrat
pyrat / gist:4127745
Created November 21, 2012 21:11
postgres, fix the gimp
nstead, you need to open up this file /etc/postgresql/9.1/main/pg_hba.conf in a text editor (with root privileges, of course) and change this line:
local all all peer
to this:
local all all md5
Now, restart the postgres server:
sudo service postgresql restart
# git aliases
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gad='git add .'
@pyrat
pyrat / gist:3986239
Created October 31, 2012 10:10
new deadmaus
http://thepiratebay.se/torrent/7678431/Deadmau5_-_Album_Title_Goes_Here_(2012)_DutchReleaseTeam
@pyrat
pyrat / gist:3941918
Created October 23, 2012 21:59
monit install src
wget [monit src]
tar xvf [monit archive]
cd monit_dir
sudo apt-get install libpam0g-dev
./configure --without-ssl
make && sudo make install
@pyrat
pyrat / gist:3938144
Created October 23, 2012 10:52
build 12.04 Using kickstart, xen
VMUUID=$(xe vm-install new-name-label="Ubuntu 12.04" template=de27dfda-c356-9641-0a28-5f2d7552f7af)
NETUUID=$(xe network-list bridge=xenbr0 --minimal)
xe vif-create vm-uuid=$VMUUID network-uuid=$NETUUID mac=random device=0
xe vm-param-set uuid=$VMUUID other-config:install-repository=http://us.archive.ubuntu.com/ubuntu
xe vm-param-set uuid=$VMUUID PV-args="ks=http://s3.amazonaws.com/excitedmedia/kickstart-minimal-precise-x86_64.cfg ksdevice=eth0"
xe vm-param-set uuid=${VMUUID} other-config:disable_pv_vnc=1
xe vm-memory-limits-set uuid="${VMUUID}" static-min="805306368" dynamic-min="805306368" dynamic-max="805306368" static-max="805306368"
xe vm-start uuid=$VMUUID
@pyrat
pyrat / gist:3927980
Created October 21, 2012 18:25
Everything you can override in a refinerycms project with refinerycms-blog
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
@pyrat
pyrat / gist:3907089
Created October 17, 2012 18:05
new-syslog
Oct 17 17:29:30 syslogd started: BusyBox v1.18.5
Oct 17 17:29:30 kernel: klogd started: BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4)
Oct 17 17:29:30 kernel: [ 0.000000] Initializing cgroup subsys cpuset
Oct 17 17:29:30 kernel: [ 0.000000] Initializing cgroup subsys cpu
Oct 17 17:29:30 kernel: [ 0.000000] Linux version 3.2.0-23-generic (buildd@crested) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu4) ) #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 (Ubuntu 3.2.0-23.36-generic 3.2.14)
Oct 17 17:29:30 kernel: [ 0.000000] Command line: ks=http://s3.amazonaws.com/excitedmedia/kickstart-minimal-precise-x86_64.cfg ksdevice=eth0
Oct 17 17:29:30 kernel: [ 0.000000] KERNEL supported cpus:
Oct 17 17:29:30 kernel: [ 0.000000] Intel GenuineIntel
Oct 17 17:29:30 kernel: [ 0.000000] AMD AuthenticAMD
Oct 17 17:29:30 kernel: [ 0.000000] Centaur CentaurHauls