Skip to content

Instantly share code, notes, and snippets.

import h5py
import numpy
import time
import sys
from multiprocessing import Process
FNAME = 'foo.h5'
enricmcalvo /
Last active September 3, 2018 06:32 — forked from rossant/
Consider your software broken if

Consider your software broken if:

  • You're the only one to understand how it works
  • You can't remember what a function does just by reading its name
  • You're not using a version control system
  • You're not using continuous integration
  • You're not continuously monitoring the quality of your code
  • You have little or no unit tests
  • You have little or no integration tests
  • You don't use an issue tracker


every time you write a comment you failed. commented out code is an abomination that must be destroy before it spreads.


white space discipline is important Be consistent horizontal scrolls will not be tolerated(between 40 and 120 columns) keep file sizes under control average between 100 lines and never exceed 500

enricmcalvo /
Created March 7, 2015 06:56
PipaOS fix for broken apt-get due to missing/broken python-rpi.gpio package
# Simple gist to fix pipaos issue that won't allow to install or update any package because of python-rpi.gpio missing (or broken)
sudo dpkg -i python-rpi.gpio_0.5.11-1_armhf.deb
sudo apt-get update
sudo apt-get upgrade
View Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using (iTerm has mouse support)
Then install
# More on mouse support
while true;
git log \
--graph \
--all \
--color \
--date=short \
-40 \
enricmcalvo /
Last active December 20, 2015 16:49
Debugging in IPython

#Debugging in IPython

Declared the function:

def debug(f, *args, **kwargs):
    from pdb import Pdb as OldPdb
        from IPython.core.debugger import Pdb
 kw = dict(color_scheme='Linux')
enricmcalvo / gist:6151189
Last active December 20, 2015 14:59
View gist:6151189
enricmcalvo / gist:6151178
Last active December 29, 2022 12:20
RDP SSL tunneling
View gist:6151178

RDP SSL tunneling with stunnel

stunnel utility can be used to tunnel RDP connexions through HTTPS/SSL in order to pass through proxies. It served the same purpose as the Microsoft RDP gateway, but without requirements for Windows Server and licences. I use it for connections to my home PC from work.

General configuration

The 2 sides for the RDP connexion are :

  • The server side :
  • The server is the PC you want to connect to (typically your home PC). Remote connections have to be enabled in the computer properties of that machine, and the local firewall adjusted for corresponding traffic (TCP 3389).