Skip to content

Instantly share code, notes, and snippets.

View h5_create_read_write_issue.py
import h5py
import numpy
import time
import sys
from multiprocessing import Process
FNAME = 'foo.h5'
@enricmcalvo
enricmcalvo / broken.md
Last active Sep 3, 2018 — forked from rossant/broken.md
Consider your software broken if
View broken.md

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
View clean_code.md

Comments

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

Formatting

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
enricmcalvo / pipaos_fix.sh
Created Mar 7, 2015
PipaOS fix for broken apt-get due to missing/broken python-rpi.gpio package
View pipaos_fix.sh
# Simple gist to fix pipaos issue that won't allow to install or update any package because of python-rpi.gpio missing (or broken)
wget http://sourceforge.net/projects/raspberry-gpio-python/files/raspbian-wheezy/python-rpi.gpio_0.5.11-1_armhf.deb
wget http://sourceforge.net/projects/raspberry-gpio-python/files/raspbian-wheezy/python3-rpi.gpio_0.5.11-1_armhf.deb
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 Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
View gitlivelog.sh
#!/bin/sh
while true;
do
clear
git log \
--graph \
--all \
--color \
--date=short \
-40 \
@enricmcalvo
enricmcalvo / ipython_debug.md
Last active Dec 20, 2015
Debugging in IPython
View ipython_debug.md

#Debugging in IPython

Declared the function:

def debug(f, *args, **kwargs):
    from pdb import Pdb as OldPdb
    try:
        from IPython.core.debugger import Pdb
 kw = dict(color_scheme='Linux')
View gist:6151189

Automatic update configuration for dyndns

Get dynamic DNS account

DLink offers free dyn.com dynamic DNS accounts for any user for a single hostname on dlinkddns.com domain (it's still possible to get a similar account directly from dyn, but more complex). Create the account and the host on https://www.dlinkddns.com/login.

Hostname : xxxxx.dlinkddns.com username : dlinkusername password ! dlinkpassword

Download ddclient

@enricmcalvo
enricmcalvo / gist:6151178
Last active Mar 9, 2022
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).