Skip to content

Instantly share code, notes, and snippets.

@germanramos
germanramos / get connections
Created Jun 5, 2014
Get number of connections of a process
View get connections
#Option 1: lsof
sudo lsof -n -i | grep 23889 | wc -l
#Option 2: python + psutil
>sudo python
import psutil
len(psutil.Process(23889).get_connections(kind='inet'))
View nodejs-ubuntu-bind-port-80.md

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

View .screenrc
# export GIT_HOME="${HOME}/dev/git"
# turns off the license screen
startup_message off
# Status bar
hardstatus on
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
@germanramos
germanramos / gist:3944990c8e36383b6c6f
Last active Aug 29, 2015
Bash prompt with git info and completition and colors
View gist:3944990c8e36383b6c6f
In .bash_profile (or .bashrc):
# Git completion
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
# My prompt
#http://ubuntulife.files.wordpress.com/2011/04/bashcolor.png
export PS1='\e[01;36m\]\u:\[\e[01;33m\]\w $(__git_ps1 "(%s)")\[\e[0m\]\n>'
@germanramos
germanramos / tunnel.md
Last active Dec 31, 2015
Create SSH tunnels
View tunnel.md

#On the client: sudo ssh-keygen -f /root/topicTunnel.pem #On the Server: sudo useradd -m -s /bin/false tunnel
sudo -u tunnel bash
cd /home/tunnel
mkdir .ssh
chmod 700 .ssh

@germanramos
germanramos / Versionado.md
Last active Jan 3, 2016
Versionado de applicaciones
View Versionado.md

En este documento se explican las convenciones a seguir para hacer el tageado de versiones en nuestros desarrollos.

Vamos a utilizar como base lo explicado aqui

En resumen es lo siguiente vMAJOR.MINOR.PATH:

  • MAJOR version when you make incompatible API changes
  • MINOR version when you add functionality in a backwards-compatible manner, and
  • PATCH version when you make backwards-compatible bug fixes.

Además, siempre que creemos un nuevo tag de versión actualizaremos el tag latest para que siempre apunte a la ultima versión tageada.

@germanramos
germanramos / Bug SSL vagrant-google in MAC OSX. And Workaround
Created Jan 24, 2014
Bug SSL vagrant-google in MAC OSX. And Workaround
View Bug SSL vagrant-google in MAC OSX. And Workaround
Error:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Motivo:
Fallo en la lectura de autoridades de certificación
Work around:
Fichero: /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb
Añadir en la linea 779 aprox: