Skip to content

Instantly share code, notes, and snippets.

gem 'mechanize', '2.7.2'
require 'mechanize'
require 'pony'
def sendmail(to, subject, body)
Pony.mail({
:to => to,
:via => :smtp,
:subject => subject,
:body => body,
@leonardofaria
leonardofaria / gist:1071044
Created July 8, 2011 03:09
Bash script to create and initialize a git repo on a dreamhost server
# Based on:
# http://casperfabricius.com/site/2008/09/21/keeping-git-repositories-on-dreamhost-using-ssh/
# https://gist.github.com/108398
DREAMGIT_DOMAIN=user@domain.com
GIT_DOMAIN=git_server
DH_USER=home/user
# set up on the server
ssh $DREAMGIT_DOMAIN 'mkdir -p '$GIT_DOMAIN'/'$1'.git && cd '$GIT_DOMAIN'/'$1'.git && git --bare init'
@leonardofaria
leonardofaria / mysql_to_sqlite.sh
Created September 25, 2011 14:52
Convert MySQL dump to SQLite database / via http://goo.gl/p7Sxj
#!/bin/bash
if [ "x$1" == "x" ]; then
echo "First: mysqldump -u root -p --compatible=ansi --skip-opt database > dumpfile"
echo "Usage: $0 <dumpfile>"
exit
fi
cat $1 |
grep -v ' KEY "' |
@leonardofaria
leonardofaria / gist:1314898
Created October 26, 2011 00:17
E se motoristas fossem contratados da mesma maneira que programadores?
Cargo: Motorista.
Exigências do trabalho: Competência profissional em condução de veículos leves como carros e pesados como ônibus e caminhões, ônibus articulados, bondes, metrô, tratores, escavadoras e pás carregadoras, e tanques pesados atualmente em uso pelos países da OTAN.
Habilidades em Rali e de condução extremas são obrigatórios!
Experiência na Fórmula-1 é um diferencial.
Conhecimento e experiência em reparação de motores de pistão e rotor, transmissões automáticas e manuais, sistemas de ignição, computador de bordo, ABS, ABD, GPS e sistemas de áudio automotivo dos fabricantes conhecidos mundialmente – obrigatória!
Experiência em tarefas de pintura e funilaria de automóveis é um diferencial.
@leonardofaria
leonardofaria / gist:2495308
Created April 26, 2012 02:40
hidden tweaks to os x
# lock icon positions in dock
defaults write com.apple.dock contents-immutable -bool true
# add recent applications in dock
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
killall Dock
# set extension to screenshots
defaults write com.apple.screencapture type jpg
{
"auto_completecommiton_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"font_face": "Meslo LG S Regular for Powerline",
"font_size": 17.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"open_files_in_new_window": false,
"rulers":
@leonardofaria
leonardofaria / quiz3.js
Created October 20, 2015 21:16
WMDD 4820 - Quiz 3
// 1. How many times are the following loop bodies repeated?
// What is the printout of each loop? (3 points)
// a.
var i = 1;
while (i < 10)
if (i % 2 == 0)
document.write( i + "<br />");
// Answer: infinity loop. i will be never incremented.
http://www.flotcharts.org/
http://www.highcharts.com/
http://www.jscharts.com/
http://oesmith.github.com/morris.js/
http://raphaeljs.com/
http://g.raphaeljs.com/
http://www.rgraph.net/examples/
http://code.shutterstock.com/rickshaw/
http://xaviershay.github.com/tufte-graph/
{
// esse é o arquivo de configurações do sublime
// ele é organizado em um formato json
// mais informações:
// http://leonardofaria.net/2012/12/31/configurando-o-sublime-text-2
// http://simplesideias.com.br/configurando-o-sublime-text-2
// configurações visuais
"theme": "Soda Light.sublime-theme",
# ducknorris custom theme
# FreeAgent puts the powerline style in zsh !
if [ "$POWERLINE_DATE_FORMAT" = "" ]; then
POWERLINE_DATE_FORMAT=%D{%Y-%m-%d}
fi
if [ "$POWERLINE_RIGHT_B" = "" ]; then
POWERLINE_RIGHT_B=%D{%H:%M:%S}
elif [ "$POWERLINE_RIGHT_B" = "none" ]; then