Skip to content

Instantly share code, notes, and snippets.

View jlbfalcao's full-sized avatar

Jorge Falcão jlbfalcao

View GitHub Profile
eager_load -> load all wit left join
includes
joins
@jlbfalcao
jlbfalcao / gist:5796791
Created June 17, 2013 13:18
converting all files from us-ascii to utf-8
find path -type f | xargs file --mime-encoding | grep us-ascii | cut -d: -f 1 | while read f; do
mv $f{,.ascii}
echo $f
iconv -f UTF-8 -t US-ASCII $f.ascii > $f
rm $f.ascii
# git add $f
done
@jlbfalcao
jlbfalcao / vim.rb
Created September 23, 2012 17:19 — forked from bmatheny/vim.rb
Vim Formula with Ruby & Python support for OS X
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
version '7.3.666'
url 'https://vim.googlecode.com/hg/', :revision => '1e22adc6176e'
head 'https://vim.googlecode.com/hg/'
def ruby_bin
@jlbfalcao
jlbfalcao / gist:3706936
Created September 12, 2012 14:23
SSH Config + Forward + Compression
# add to ~/.ssh/config
Host yourhost
User root
HostName yourhost.domain
Compression yes
ForwardX11 yes
CompressionLevel 9
@jlbfalcao
jlbfalcao / gist:3082642
Created July 10, 2012 10:53
Getting x.y.z-release from a git-tag
data = %x{git log -n 1 --decorate --pretty=oneline}.match(/tag: (?<version>\d+\.\d+\.\d+)-(?<release>\w+)/)
data[:version]
data[:release]
@jlbfalcao
jlbfalcao / gist:1388930
Created November 23, 2011 15:16
Jruby + Bundler - CentOS SETUP
# getting source
wget 'http://jruby.org.s3.amazonaws.com/downloads/1.6.5/jruby-bin-1.6.5.tar.gz' --directory-prefix=`rpm --eval '%{_sourcedir}'`
git clone git@github.com:jlbfalcao/jruby-rpm.git
cd jruby-rpm
cp * `rpm --eval '%{_sourcedir}'`
# build rpm
rpmbuild -bb jruby.spec
@jlbfalcao
jlbfalcao / git-backup.sh
Created August 26, 2011 01:44
MySQL Backup/Restore between git-branches
#!/bin/sh
BRANCH=`git status --short -b | head -n 1 | awk '{print $2}'`
# echo $BRANCH
echo ""
mkdir -p backups
FILE="backups/$BRANCH.sql.gz"
if [ "$1" == "restore" ]; then
@jlbfalcao
jlbfalcao / gist:1143112
Created August 12, 2011 22:08
SocketChannel problem
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.channels.SocketChannel;
public class LeakTest {
public static void main(String[] args) {
new LeakTest().test();
var obj = (function() {
var list = [];
return {
f: function() {
return list;
}
}
})();
@jlbfalcao
jlbfalcao / gist:1043984
Created June 24, 2011 00:37
Build jruby-1.6.2 RPM
wget http://jruby.org.s3.amazonaws.com/downloads/1.6.2/jruby-bin-1.6.2.tar.gz
tar -xvzf jruby-bin-1.6.2.tar.gz
cat > post-install.sh <<EOF
echo "PATH=/opt/jruby-1.6.2/bin:\\\${PATH}" > /etc/profile.d/jruby.sh
chmod +x /etc/profile.d/jruby.sh
EOF
cat > pre-uninstall.sh <<EOF
rm /etc/profile.d/jruby.sh
EOF