Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# From https://docs.docker.com/compose/gettingstarted/
cd /tmp
# Create a directory for the project
mkdir composetest
cd composetest
@e-roux
e-roux / python_setup_raspbian.sh
Last active February 21, 2019 06:33
Install Python under Raspbian
#!/bin/bash
# This script is meant for quick & easy install via:
# $ curl -fsSL https://gist.githubusercontent.com/gwin-zegal/d9b4a1ec926bd6654aaa1e3670de86e1/raw/python_setup_raspbian.sh | sh
sudo apt-get -y update
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
PY_VERSION='3.7.2'
@e-roux
e-roux / ProtocolBuffer.sh
Last active March 20, 2019 06:23
Hadoop on raspberry
#!/bin/bash
# ProtocolBuffers is an open source project supporting Google's
# ProtocolBuffer's platform-neutral and language-neutral interprocess-communication (IPC) and serialization framework. It has an Interface Definition Language (IDL) that is used to describe the wire- and file formats; this IDL is then pre-compiled into source code for the target languages (Python, Java and C++ included), which are then used in the applications.
cd /tmp
wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
tar xf protobuf-2.5.0.tar.bz2
@e-roux
e-roux / app.properties
Created February 15, 2019 08:43
Mediaplayer under raspberry pi (one USB DAC + one hifiberry on one rpi)
# /opt/mediaplayer/latest/app.properties
airplay_audio_start_delay=false
airplay_enabled=false
airplay_latency_enabled=true
airplay_master_volume_enabled=false
airplay_port=5002
java_sound_software_mixer_enabled=false
java_soundcard_suffix=[PLUGHW\:0,0]--PRIMARY SOUND DRIVER
log_console_level=off
log_file_level=error
import sys
from os.path import abspath, dirname, join as pjoin
import logging
import warnings
from functools import partial
from enum import IntEnum
from ctypes import (c_int, c_double, c_void_p, Structure, byref)
import numpy as np
import xarray as xr
@e-roux
e-roux / ipy_repl.py
Created February 28, 2018 21:49
SublimeText
"""
~/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/ipy_repl.py
"""
import os
import sys
import json
import socket
import threading
import IPython
@e-roux
e-roux / indent.sh
Last active May 12, 2019 15:13
Bash scripts
#!/bin/sh
# File: indent.sh
# Opens a set of files in emacs and executes the emacs-format-function.
#
# This one is based on:
# http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html
emacsscript=/tmp/.emacs-indent
cat > ${emacsscript} << EOF
@e-roux
e-roux / PyDataSet.py
Last active January 7, 2018 14:11
Python: PyDataSet
class PyDataSet(object):
import pandas as pd
"""
Retrieves R Dataset
"""
db = pd.read_csv("http://vincentarelbundock.github.com/Rdatasets/datasets.csv")
db.set_index('Item', drop=True, inplace=True)
@classmethod
def search(cls, name):
@e-roux
e-roux / custom.css
Created November 19, 2017 17:19
Jupyter notebook configuration
/*
Basis css inspired from
http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css
http://www.labri.fr/perso/nrougier/from-python-to-numpy/index.html
Color scale:
https://github.com/d3/d3-scale/blob/master/README.md#scaleOrdinal
https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md
@e-roux
e-roux / SafariBookmarkEditor
Last active March 25, 2019 10:54
Mac OS: python module for easily adding, removing, and moving positions of Safari bookmarks in the context of the currently logged in user.
#!/usr/bin/python
#
# From https://github.com/robperc/SafariBookmarkEditor
#
# Revision
# 23/10/2017 - ported to Python 3, PEP8 fixes
#
"""
Python module for easily adding, removing, and moving positions of Safari