Skip to content

Instantly share code, notes, and snippets.

View soxofaan's full-sized avatar

Stefaan Lippens soxofaan

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soxofaan
soxofaan / here-jupyter.sh
Last active March 23, 2021 23:34
here-jupyter: launch Jupyter Notebook in background from current directory using tmux
#!/bin/bash
# Build tmux session name from current directory
SESSION_NAME=$(pwd)
# Strip non-alphanumeric characters
SESSION_NAME=${SESSION_NAME//[^a-zA-Z0-9]/}
# Only keep trailing part
SESSION_NAME=Jupyter-${SESSION_NAME: -20}
# Command to run inside tmux session
@soxofaan
soxofaan / .block
Last active November 19, 2023 20:06
Microphone pitch detection
license: mit
height: 400
border: no
@soxofaan
soxofaan / .block
Last active August 15, 2019 21:55
Microphone Spectrum Analyser
license: mit
height: 500
border: no
@soxofaan
soxofaan / signal_catcher_context.py
Last active April 13, 2019 16:12
Python (3.6+) context manager that catches signals (e.g. SIGINT, SIGTERM) and exposes that. Allows writing infinite loops that can be exited in a clean way.
import logging
import os
import signal
import time
log = logging.getLogger(__name__)
class SignalCatcher:
@soxofaan
soxofaan / .block
Last active December 29, 2018 17:06
Circle of Fifths with Diatonic Seventh Chords
license: mit
height: 800
border: no
@soxofaan
soxofaan / pandas-timeindex-secondary-y-issue.ipynb
Last active December 13, 2017 17:25
pandas-timeindex-secondary-y-issue.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soxofaan
soxofaan / zequals.py
Last active November 28, 2017 08:52
"Zequals" ruthless rounding: just keep one leading digit.
import math
def zequals(x):
"""
"Zequals" ruthless rounding: just keep one leading digit.
examples:
123 -> 100
4567 -> 5000
-0.0345 -> -0.03

Google Apps Script to automatically delete mails with a certain label after a certain time

Usage

  1. Think of a deletion scheme and create GMail labels accordingly (e.g. I use labels 'todelete/after1week', 'todelete/after1month' and 'todelete/after3months' here)
  2. set up filters in GMail to flag desired mails with these labels
  3. create a Google Apps Script with this script (adapt function names, labels and day offsets appropriatedly) and set up triggers as desired

Disclaimer

@soxofaan
soxofaan / .block
Last active August 15, 2017 12:23
Four-dimensional hypersphere packing
license: mit
border: no