Skip to content

Instantly share code, notes, and snippets.

View lsdr's full-sized avatar

Luiz Rocha lsdr

  • São Paulo, Brazil
  • 21:51 (UTC -03:00)
View GitHub Profile
@lsdr
lsdr / rbenv-install-cmdline.sh
Last active December 22, 2015 15:09
Scripts and stuff that helped me migrate from rvm to rbenv
#!/bin/sh
# CFLAGS="-arch x86_64 -g -O2" CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p247
__install_ruby () {
local CFLAGS='-arch x86_64 -g -O2'
local READLINE=`brew --prefix readline`
local OPENSSL=`brew --prefix openssl`
if [ -d "$READLINE" ]; then
@lsdr
lsdr / my_python_env.sh
Last active September 28, 2021 21:40
requirements.txt and a quick sh script to bootstrap my core virtualenv
#!/bin/sh
# assumptions:
# * virtualenv is avaliable and working
# * virtualenvs go to ~/.pvm
export PIP_REQUIRE_VIRTUALENV=true
export PIP_RESPECT_VIRTUALENV=true
export VIRTUALENV_DISTRIBUTE=true
cd ~; mkdir -p ~/.pvm/core
virtualenv --python=/usr/bin/python --clear --no-site-packages --distribute ~/.pvm/core
@lsdr
lsdr / es.sh
Last active December 14, 2015 16:48 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk -y
curl -XGET -L https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz -o elasticsearch-0.20.5.tar.gz
tar -xf elasticsearch-0.20.5.tar.gz
mv elasticsearch-0.20.5 elasticsearch
sudo mv elasticsearch /usr/local/share
@lsdr
lsdr / login.py
Created November 12, 2012 04:34
tweaked out version of simplegeo/oauth2 3-way auth adapted to Y! Sports API
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
simplegeo/python-oauth2 basic 3-legged example adapted to Y! Sports OAuth API
references:
https://github.com/simplegeo/python-oauth2#twitter-three-legged-oauth-example
https://github.com/simplegeo/python-oauth2/issues/10
http://stackoverflow.com/questions/4026759/problems-with-python-oauth2-and-yahoos-fantasy-sports-api
"""
@lsdr
lsdr / net-sec-cheatsheet.sh
Last active July 29, 2018 19:05
unix sec-related cheatsheet
# references
# https://www.thegeekstuff.com/2012/08/lsof-command-examples/
# list open network files
sudo lsof -PiTCP -sTCP:LISTEN
# list files opened by a process
lsof -c ssh
@lsdr
lsdr / saints-louis-and-paulo.txt
Created August 29, 2012 11:15
Stupid comparison between St. Louis/MO and São Paulo/SP
St. Louis São Paulo
========================================================================
where? Missouri, EUA São Paulo, Brasil
http://goo.gl/maps/g15x7 http://goo.gl/maps/Hf6Jj
population (2011) 318.069 11.316.149
area (km2) 171.3 1.522.986
founded 1764 1544
elevation (m) 142 760
time zone UTC-6 UTC-3
@lsdr
lsdr / build-python-27.sh
Created August 8, 2012 12:45
alt-install python2.7 on a x86_64 centos6 box
#!/bin/bash
# Install Python 2.7.3 alternatively
# original script:
# https://github.com/bngsudheer/bangadmin/blob/master/linux/centos/6/x86_64/build-python-27.sh
#
yum groupinstall "development tools" -y
yum install -y readline-devel openssl-devel gmp-devel \
ncurses-devel gdbm-devel zlib-devel expat-devel libGL-devel \
tk tix gcc-c++ libX11-devel glibc-devel bzip2 tar tcl-devel \
tk-devel pkgconfig tix-devel bzip2-devel sqlite-devel autoconf \
@lsdr
lsdr / clear-apple-logs.sh
Created June 28, 2012 12:45
a myriad of small scripts and/or cmd-one-liners to do mac maintenance
#!/bin/sh
# http://osxdaily.com/2010/05/06/speed-up-a-slow-terminal-by-clearing-log-files/
rm -rf /private/var/log/asl/*.asl
@lsdr
lsdr / children.txt
Last active September 26, 2015 01:38
Coleção de citações de livros de SCI-FI
... era incapaz de explicar por que tais pensamentos vinham a seu encontro, no
meio da noite, e por que faziam com que se sentisse tão culpado. Agachou-se
dentro de seu manto. A realidade não era nem um pouco como o sonho. O Deserto
Amistoso, que um dia se estendera de um pólo a outro, estava reduzido à metade
de seu tamanho. O paraíso mítico das extensões verdes que se ampliavam o enchia
de angústia.
Não era como o sonho. Enquanto seu planeta mudava, ele também mudava.
Tornara-se uma pessoa mais sutil do que o chefe de sietch que um dia fora. Agora
@lsdr
lsdr / ccat
Last active April 22, 2019 12:57
stuff I keep on ~/bin
#!/bin/bash
# Font: http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/
if [ ! -t 0 ]; then
file=/dev/stdin
elif [ -f $1 ]; then
file=$1
else
echo "Usage: $0 code.c"
echo "or e.g. head code.c|$0"
exit 1