Skip to content

Instantly share code, notes, and snippets.

View sandys's full-sized avatar

Sandeep Srinivasa sandys

View GitHub Profile
@sandys
sandys / systemd-journal-setup.sh
Last active August 29, 2015 13:56
journal setup for systemd
install -d -g root /var/log/journal
setfacl -R -nm g:adm:rx,d:g:adm:rx /var/log/journal
#in /etc/systemd/journald.conf
#comment the following
`#ForwardToSyslog=
#ForwardToKMsg=
#ForwardToConsole=`
@sandys
sandys / full_synclient_config.sh
Last active August 29, 2015 13:58
Linux synclient configuration for two finger scrolling on alps touchpad (Dell Latitude 6410)
Parameter settings:
LeftEdge = 300
RightEdge = 1700
TopEdge = 210
BottomEdge = 1190
FingerLow = 5
FingerHigh = 7
MaxTapTime = 200
MaxTapMove = 107
MaxDoubleTapTime = 200
@sandys
sandys / pyside_on_linux.sh
Last active August 29, 2015 14:23
install pyside on linux
sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev git libpq-dev libmysqlclient-dev libpq-dev nodejs libcurl4-openssl-dev libffi-dev imagemagick libjpeg-progs pngcrush cmake qt4-qmake libqt4-dev sni-qt
wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar zxvof Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=$PWD/release --enable-shared --enable-unicode=ucs2 LDFLAGS=-Wl,-rpath=$PWD/release/lib
make
make install
#your new python is in Python-2.7.8/release/bin/python
@sandys
sandys / get_size_count_human.sh
Created August 8, 2015 22:49
get size and count of a s3 bucket in human readable form
aws s3api --profile redcarpetup_media list-objects --bucket media.chefatlarge.in --output json --query "[sum(Contents[].Size), length(Contents[])]" | awk 'NR!=2 {print $0;next} NR==2 {print $0/1024/1024/1024" GB"}'
@sandys
sandys / wordpress_nginx_apache_subdirectory_wpadmin.sh
Created August 18, 2015 17:06
Wordpress: nginx proxying to apache2. Wordpress installed in a subdirectory. All wp-admin and wp-login links working
# in wp-config.php
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/recipedia');
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/recipedia');
$_SERVER['REQUEST_URI'] = '/recipedia' . $_SERVER['REQUEST_URI'];
#in nginx config
location /recipedia/ {
proxy_pass http://127.0.0.1:85/;
@sandys
sandys / fastcgi_params
Created September 16, 2015 12:57
fastcgi params for wordpress on debian 8 with php5-fpm
#These two lines were missing from my /etc/nginx/fastcgi_params, make sure they are there!
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
@sandys
sandys / innobackupex.sh
Last active September 16, 2015 14:43
innobackup working
#source
innobackupex --user=root --password=root /www/DB-BACKUP
#destination
scp root@server:/www/DB-BACKUP /tmp
innobackupex --apply-log --ibbackup=xtrabackup /tmp/DB-BACKUP/2015-09-16_12-05-39/
innobackupex --copy-back /tmp/DB-BACKUP/2015-09-16_12-05-39/
rm /var/lib/mysql-new/ib_logfile1
rm /var/lib/mysql-new/ib_logfile0
# history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=100000
setopt appendhistory autocd extendedglob
setopt EXTENDED_HISTORY # puts timestamps in the history
BLACK="%{"$'\033[01;30m'"%}"
GREEN="%{"$'\033[01;32m'"%}"
@sandys
sandys / rails.md
Created March 18, 2011 07:33
random tidbits about rails

You need to create a getter and setter method to create a virtual attribute

 def full_name
  [first_name, last_name].join(' ')
 end

 def full_name=(name)
  split = name.split(' ', 2)
  self.first_name = split.first
  self.last_name = split.last

end