Skip to content

Instantly share code, notes, and snippets.

View Aricg's full-sized avatar

Aric Gardner Aricg

View GitHub Profile
@Aricg
Aricg / gist:3948021
Created October 24, 2012 18:48
remove rabbitmq and start again
#!/bin/bash
/etc/init.d/rabbitmq-server stop
for x in $(ps -ef | grep -v grep | grep rabbit | awk '{print $2}'); do kill -9 $x; echo "Process id $x is killed"; done
rm /var/lib/rabbitmq/.erlang.cookie
rm -rf /var/lib/rabbitmq/mnesia/
rm -rf /etc/rabbitmq/
apt-get remove --purge rabbitmq-server
apt-get autoremove
@Aricg
Aricg / gist:3959591
Created October 26, 2012 15:57
convert apache rewrite to nginx for wp-uploads
#Apache
RewriteRule ^/wp-uploads/(.*)$ /srv/www/wp-uploads/%{HTTP_HOST}/$1
#nginx
location /wp-uploads/ {
rewrite ^/wp-uploads/(.*)$ /$1 break;
root /srv/www/wp-uploads/$host;
}
@Aricg
Aricg / pre-gliffy
Created October 30, 2012 20:23
Some network diagram somewhere
(INTERNET)
|
HAPROXY\ | /HAPROXY-STANDBY
NFS- DRBD1 <------VIP DRBD2 -NFS-STANDBY
MYSQL/ /|\ \MYSQL-STANDBY
/ | \
WEB1 WEB2 WEB3 WEB4 (apache's mpm-itk/nginx php5-fpm)
@Aricg
Aricg / pre-gliffy
Created November 4, 2012 21:05 — forked from msterle/pre-gliffy
Some network diagram somewhere
(INTERNET)
|
HAPROXY\ | /HAPROXY-STANDBY
NFS- DRBD1 <------VIP DRBD2 -NFS-STANDBY
MYSQL/ / /|\ \ \MYSQL-STANDBY
PUPPET/ / | \ \STORAGE
/ | \
WEB1 WEB2 WEB3 WEB4 (apache's mpm-itk/nginx php5-fpm)
case $multiple_nodes {
yes: {
file { 'rabbitmq.config':
ensure => file,
path => '/etc/rabbitmq/rabbitmq.config',
content => template("${module_name}/rabbitmq.config"),
owner => 'rabbitmq',
group => 'rabbitmq',
mode => '0644',
#clean debian 6.0 machine
su - root
apt-get install build-essential curl libyaml-dev
curl -L https://get.rvm.io | bash -s stable
source /usr/local/rvm/scripts/rvm
echo "[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm" " >> ~/.bash_profile
source ~/.bashrc
rvm pkg install zlib --verify-downloads 1
rvm install 1.9.1 --verify-downloads 1
@Aricg
Aricg / vhost.bash
Last active December 11, 2015 23:19
#!/bin/bash
#set -e
allfiles=(/root/work4/xi_wang);
#echo "I count ${#allfiles[@]} afiles to manipulate."
for afile in ${allfiles[@]};
do
virtualhostcount=0
#... I should use awk rather than grep..
@Aricg
Aricg / node_debian_init.sh
Last active December 14, 2015 04:59 — forked from peterhost/node_debian_init.sh
Init file for hastebin server (assuming installed to /home/hastebin/haste-server )
#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin # modify if you need
DAEMON_ARGS="/home/hastebin/haste-server/server.js" # path to your node.js server/app
DESC="node.js pastebin server" # whatever fancy description you like
NODEUSER=hastebin:hastebin # USER who OWNS the daemon process (no matter whoever runs the init script)
LOCAL_VAR_RUN=/var/run # in case the init script is run by non-root user, you need to
NAME=node # name of the node.js executable
DAEMON=/usr/local/bin/$NAME # this SHOULD POINT TO where your node executable is
#!/bin/bash
#(optional) in the format user.name:password@ (you need the @ after)
password="$(< ~/.hidden_password)"
url="hastebin.com"
key="$(curl --silent --insecure --data-binary @/dev/fd/0 https://"$password""$url"/documents | cut -d "\"" -f 4)"
echo "https://"$url"/"$key""
@Aricg
Aricg / datafart.bash
Created March 29, 2013 20:40
Making I/O graphs for a customer
#!/bin/bash
#This Script parses the output of these two files
#iostat -N vg_backup-lv_backup 1 > iostat_output &
#cat iostat_output | grep vg_backup-lv_backup >vg_only
#where vg_backup-lv_backup is the name of your lv (see the names of you lvs here ls -l /dev/mapper/)
numlines=5000
geta() {