Skip to content

Instantly share code, notes, and snippets.

View lsaffie's full-sized avatar

Luis Saffie lsaffie

View GitHub Profile
@lsaffie
lsaffie / gist:3ed8cb57f2446482661d
Last active August 29, 2015 14:06
upgrade vm to Wheezy and install mysql 5.6
#Let's back up just in case
sudo mv /var/lib/mysql /var/lib/mysql-saved
#replace your /etc/apt/sources.list with the lines below: (beetween BEGIN/END)
#---BEGIN
deb http://ftp.us.debian.org/debian/ wheezy main
deb-src http://ftp.us.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
@lsaffie
lsaffie / hsdevbox
Last active August 29, 2015 14:07
build hsdevbox
#Make sure github is trusted prior to running this
# ssh github.com
#Usage wget --no-check-certificate -O - https://gist.github.com/lsaffie/5259be3fd24008ebb7db/raw/hsdevbox |bash
#using dotdeb
echo 'deb http://packages.dotdeb.org wheezy all' | sudo tee --append /etc/apt/sources.list
echo 'deb-src http://packages.dotdeb.org wheezy all' | sudo tee --append /etc/apt/sources.list
sudo apt-get update
@lsaffie
lsaffie / gist:e4c303adf60c0e7b1f12
Last active August 29, 2015 14:11
EC2 instance - ubuntu
#Make sure github is trusted prior to running this
# ssh github.com
#Usage wget --no-check-certificate -O - https://gist.github.com/lsaffie/5259be3fd24008ebb7db/raw/hsdevbox |bash
apt-get update
echo "base packages"
@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
#!/bin/bash
#bash script to setup rbenv in one shot.
#And as a bonus, I've thrown in bundler
sudo apt-get -y install git-core curl
curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
@lsaffie
lsaffie / gist:3202888
Created July 30, 2012 00:27
mail gem usage. Checking mail and reading attachemtns
require 'mail'
def create_observations(file)
#Here's were we create observations based on the file
end
Mail.defaults do
retriever_method :pop3, :address => "pop.gmail.com",
:port => 995,
:user_name => "email@gmail.com",
@lsaffie
lsaffie / translator.rb
Last active December 12, 2015 00:19 — forked from vraravam/translator.rb
#!/usr/bin/env ruby
if ARGV.size != 2
puts "Usage: #{$0} <from_language> <to_language>"
exit -1
end
require 'rubygems'
require 'ya2yaml' # this gem is needed for this to work!
require 'yaml'
#!/bin/bash
# One stop-shop to install rbenv, friends and ruby 1.9.3
# Author: Luis Saffie <luis@saffie.ca>
# USAGE: curl https://gist.github.com/lsaffie/6258406/raw/rbenv-ubuntu-install |bash
echo "========================="
echo "remove rvm"
echo "========================="
@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
@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