Skip to content

Instantly share code, notes, and snippets.

@Hugoch
Hugoch / remove_from_history.sh
Created February 24, 2016 08:44
Completely remove a file from git history
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch YOUR_FILE' --prune-empty --tag-name-filter cat -- --all
docker run -itd —net host -p 0.0.0.0:51826:51826 $(find /dev/snd/ -type c | sed ‘s/^/ — device /’) -v /path/to/homebridge/config/folder/:/root/.homebridge hugoch/rpi-python-homebridge:v1 /root/run_homebridge.sh
{
"bridge": {
"name": "Homebridge",
"username": "8A:F8:2A:66:42:92",
"port": 51826,
"pin": "031-45-154"
},
"description": "This is an example configuration file with Phillips Hue platform.",
@Hugoch
Hugoch / mpl.py
Last active November 28, 2020 17:43
Plot flight data with matplolib
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize, LinearSegmentedColormap, PowerNorm
@Hugoch
Hugoch / gcmap.py
Last active October 19, 2015 21:03
Plot flight data with gcmap
#!/usr/bin/env python
import pandas as pd
from gcmap import GCMapper, Gradient
# define CSV colum names
CSV_COLS = ('dep_lat', 'dep_lon', 'arr_lat', 'arr_lon', 'nb_flights', 'CO2')
routes = pd.read_csv('data.csv', names=CSV_COLS,
na_values=['\\N'], sep=';', skiprows=1)
@Hugoch
Hugoch / read_csv.py
Created October 17, 2015 13:15
Read CSV with pandas
import pandas as pd
# define the expected CSV columns
CSV_COLS = ('airline', 'dep_lat', 'dep_lon', 'arr_lat',
'arr_lon', 'nb_flights', 'route')
routes = pd.read_csv(in_filename, names=CSV_COLS, na_values=['\\N'],
sep=';', skiprows=1)