Skip to content

Instantly share code, notes, and snippets.

View lsaffie's full-sized avatar

Luis Saffie lsaffie

View GitHub Profile
@lsaffie
lsaffie / gist:9622244
Last active September 23, 2015 16:51
get count of tables
DBUSER="root"
DBPASS=""
DBNAME="dbname"
array=( a b c )
for i in "${array[@]}"
do
echo $i
mysql -u$DBUSER $DBNAME -p$DBPASS -e "select count(*) from $i"
done
@lsaffie
lsaffie / Vagrantfile
Created December 18, 2013 01:41
Vagrantfile with public networking
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#VM name
config.vm.box = "homestars-devbox-vagrant"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "homestars-devbox-vagrant"
config.vm.network :private_network, ip: "10.0.0.100"
@lsaffie
lsaffie / hs-bootstrap-ec2
Last active December 29, 2015 14:28
hs-bootstrap-ec2
#Make sure github is trusted prior to running this
# ssh github.com
#Usage wget --no-check-certificate -O - https://gist.github.com/lsaffie/7683731/raw/hs-bootstrap-ec2 |bash
sudo apt-get update
echo "base packages"
sudo apt-get -y install curl libncurses-dev libgnome2-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev \
@lsaffie
lsaffie / hs-bootstrap
Last active December 27, 2015 22:29
hs-bootstrap
echo "base packages"
sudo apt-get -y install curl libncurses-dev libgnome2-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev \
libx11-dev libxpm-dev libxt-dev ruby-dev memcached build-essential openssl libssl-dev python
export DEBIAN_FRONTEND=noninteractive
sudo apt-get -q -y install mysql-server mysql-client libmysqlclient-dev
# ruby developer packages
@lsaffie
lsaffie / hs-setup
Last active December 27, 2015 18:59
hs-setup
echo "===== enable eth1 networking bug ===="
sudo echo '' > /etc/udev/rules.d/70-persistent-net.rules
mkdir ~/.bundle
echo "BUNDLE_LOCAL__HOMESTARS_RUNNER: /vagrant/homestars_runner" > ~/.bundle/config
cd /vagrant
[ ! -f /vagrant/homestars_runner ] && git clone git@github.com:homestars/homestars_runner.git
[ ! -f /vagrant/homestars-crm ] && git clone git@github.com:homestars/homestars-crm.git
[ ! -f /vagrant/homestars-mobile-server ] && git clone git@github.com:homestars/homestars-mobile-server.git
@lsaffie
lsaffie / gist:7326027
Last active December 27, 2015 12:29
install phantomjs in ubuntu 10.04
cd ~
wget http://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
tar xjf phantomjs-1.9.1-linux-x86_64.tar.bz2
sudo ln -s ~/phantomjs-1.9.1-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s ~/phantomjs-2.9.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s ~/phantomjs-1.9.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
@lsaffie
lsaffie / gist:6793887
Created October 2, 2013 13:36
.bash_profile This implements git branch colours for prompt
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source $HOME/.bashrc
# Pimp out my prompt
NOCOLOR="\[\033[0m\]"
LOCALHOST="localhost"
BAR="----"
BLK="\[\033[0;30m\]" ; BLK1="\[\033[1;30m\]" #dark grey
@lsaffie
lsaffie / open-tmux-shared
Last active April 3, 2019 16:24
opens a tmux session with four windows and 4 splits each
# opens 4 windows with 4 panels each using a shared socket
#@params [exit value, default path]
open_panels () {
if [ $1 -eq 0 ]; then
tmux -S ~/.tmuxsocket set-option default-path $2
tmux -S ~/.tmuxsocket source-file '/Users/lsaffie/.tmux/dev'
fi
}
@lsaffie
lsaffie / tmux18-ubuntu-10-04
Last active December 21, 2015 16:49
Install tmux1.8 in Ubuntu 10.04
#author: Luis Saffie <luis@saffie.ca>
#url: www.saffie.ca
#twitter: lsaffie
#
#tmux1.8 has some great features. One of them is pane zooming..
#http://blog.sanctum.geek.nz/zooming-tmux-panes/
#however, tmux 1.8 depends on libevent2 which does not come with 10.04
#solution: build from scratch!
#NOTE: LDFLAGS is used to build tmux because for some reason it can't find the ld_libs from libevent2.. Everything done by this script is legit thought...
#USAGE: wget -O - https://gist.github.com/lsaffie/6335957/raw/tmux18-ubuntu-10-04 |bash