Skip to content

Instantly share code, notes, and snippets.

View warantesbr's full-sized avatar

Willian Arantes warantesbr

View GitHub Profile
#create & deploy lamp droplet
#login via ssh as root
#initial setup (ref: http://library.linode.com/getting-started#sph_logging-in-for-the-first-time)
# update /etc/hosts (to "thalassophobia.surrealroad.com")
nano /etc/hosts
#
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
# benching https://bitbucket.org/sam_saffron/ruby-pg/commits/66a8e1e9c6984c0207d14f81ae8ef8ac69256d84
#
# automatic casting for pg
$: << '/home/sam/Source/ruby-pg/lib'
require 'pg'
require 'benchmark'
require 'active_record'
ActiveRecord::Base.establish_connection(
@warantesbr
warantesbr / hack.sh
Created March 11, 2014 10:34 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
# put in config/application.rb
config.to_prepare do
::PagesController.module_eval do
caches_page :show, :unless => proc {|c| c.user_signed_in? || c.flash.any? }
caches_page :home, :unless => proc {|c| c.user_signed_in? || c.flash.any? }
end
::Page.module_eval do
after_save :clear_static_caching!
after_destroy :clear_static_caching!
@warantesbr
warantesbr / gist:7662634
Created November 26, 2013 17:39
Toggle ActiveRecord log
# Turn ActiveRecord log off:
backup_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
# Turn it back on:
ActiveRecord::Base.logger = backup_logger
@warantesbr
warantesbr / gist:7631399
Last active December 29, 2015 06:49
Remove files recursively
find . -name "*.jpg" -exec rm -rf {} \;
@warantesbr
warantesbr / gist:7390713
Last active December 27, 2015 21:19
List all listen ports on Mac OS X
lsof -i | grep LISTEN
@warantesbr
warantesbr / gist:6324735
Last active December 21, 2015 15:09
List file changes between two commits
git log --name-only --pretty=oneline --full-index SHA-1..SHA-1 | grep -vE '^[0-9a-f]{40} ' | sort | uniq