Skip to content

Instantly share code, notes, and snippets.

View guidefreitas's full-sized avatar

Guilherme Defreitas Juraszek guidefreitas

View GitHub Profile
@guidefreitas
guidefreitas / Terminal
Created February 2, 2012 17:46
Install rubu 1.9.3 on Mac 10.7.2
sudo port install gcc42
rvm pkg install openssl
rvm remove 1.9.3
rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr --with-gcc=gcc-4.2
@guidefreitas
guidefreitas / gist:2489103
Created April 25, 2012 11:38 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'

Integers

1 + 1
2 * 2
5 / 3
5 % 3
5 ** 2
@guidefreitas
guidefreitas / latency.txt
Created May 31, 2012 16:50 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@guidefreitas
guidefreitas / mount_ram.sh
Created July 13, 2012 13:46
Montar Partição na memória RAM - Mac OSX
#!/bin/bash
ramfs_size_mb=1024
mount_point=~/volatile
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'Volatile' ${ramdisk_dev}
mkdir -p ${mount_point}
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
@guidefreitas
guidefreitas / gist:4079834
Created November 15, 2012 17:12
Opencv dependencies
sudo apt-get install build-essential checkinstall git pkg-config cmake libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev libpngwriter0-dev libpngwriter0c2 libfaac-dev libjack-jackd2-dev libjasper-dev libjasper-runtime libjasper1 libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev zlib1g-dbg zlib1g libgstreamer0.10-0 libgstreamer0.10-dev libgstreamer0.10-0-dbg gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog libavcodec-dev libavcodec52 libavformat52 libavformat-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 libdc1394-utils swig python-numpy libpython2.7 python-dev python2.7-d
@guidefreitas
guidefreitas / gist:6835491
Created October 5, 2013 01:31
gmp error on osx 10.9 GM
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
@guidefreitas
guidefreitas / gist:6867552
Created October 7, 2013 12:58
gfortran failed to build on 10.9 GM
0,1%
0,1%
0,2%
0,3%
0,3%
0,4%
0,5%
0,5%
0,6%
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
@guidefreitas
guidefreitas / gist:7012084
Last active December 25, 2015 17:19
erro thift homebrew
==> Downloading http://www.apache.org/dyn/closer.cgi?path=thrift/0.9.0/thrift-0.9.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/thrift-0.9.0.tar.gz
tar xf /Library/Caches/Homebrew/thrift-0.9.0.tar.gz
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file lib/cpp/src/thrift/transport/TSocket.h
==> ./configure --disable-debug --prefix=/usr/local/Cellar/thrift/0.9.0 --libdir=/usr/local/Cellar/thrift/0.9.0/lib --without-ruby --without-python --without-haskell --without-java --without-perl --without-php --without-erlang
./configure --disable-debug --prefix=/usr/local/Cellar/thrift/0.9.0 --libdir=/usr/local/Cellar/thrift/0.9.0/lib --without-ruby --without-python --without-haskell --without-java --without-perl --without-php --without-erlang
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes