Skip to content

Instantly share code, notes, and snippets.

@e-roux
e-roux / ssdp.py
Last active November 5, 2020 18:39 — forked from dankrause/ssdp.py
Tiny python SSDP discovery library with no external dependencies
# -*- coding: utf-8 -*-
# Copyright 2014 Dan Krause, Python 3 hack 2016 Adam Baxter
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@e-roux
e-roux / disable_mac_OS_services.sh
Last active January 18, 2018 22:44
Mac OS: disable services
#!/bin/bash
launchctl unload -w /System/Library/LaunchAgents/com.apple.photolibraryd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.cloudphotosd.plist
# disable gamed
launchctl unload -w /System/Library/LaunchAgents/com.apple.gamed.plist
@e-roux
e-roux / mediaplayerInstall.sh
Last active February 21, 2022 18:49
mediaplayer installation script
#!/bin/bash
#-----------------------------------------------------------------
# A simple script to install mediaplayer on a raspberry pi 3
#
# See source at https://github.com/PeteManchester/MediaPlayer
#
# wiki at
# https://github.com/PeteManchester/MediaPlayer/wiki/Install-Raspberry-Pi
#-----------------------------------------------------------------
@e-roux
e-roux / ohPlayerBuild.sh
Last active January 7, 2018 13:45
Raspberry PI: ohPlayer build script
#!/bin/bash
########################################
# Project home at
# https://github.com/openhome/ohPlayer
########################################
echo "Creating ohPlayer directory in /tmp dir"
cd /tmp
@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
@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 / 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 / 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 / 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
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