Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefaan Lippens soxofaan

View GitHub Profile
@soxofaan
soxofaan / phantomjs-revealjs-slide-capture.js
Last active Jul 1, 2017
PhantomJS script to capture/render screenshots of the slides of a Reveal.js powered slideshow.
View phantomjs-revealjs-slide-capture.js
/**
* PhantomJS script to capture/render screenshots of the slides of a Reveal.js powered slideshow.
*/
var page = require('webpage').create();
var args = require('system').args;
// Get url to render from command line.
var url;
if (args.length < 2) {
@soxofaan
soxofaan / .block
Last active Aug 15, 2017
Four-dimensional hypersphere packing
View .block
license: mit
border: no
@soxofaan
soxofaan / zequals.py
Last active Nov 28, 2017
"Zequals" ruthless rounding: just keep one leading digit.
View zequals.py
import math
def zequals(x):
"""
"Zequals" ruthless rounding: just keep one leading digit.
examples:
123 -> 100
4567 -> 5000
-0.0345 -> -0.03
@soxofaan
soxofaan / pandas-timeindex-secondary-y-issue.ipynb
Last active Dec 13, 2017
pandas-timeindex-secondary-y-issue.ipynb
View 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.
View AsynchronousFileReader-py3.py
import sys
import subprocess
import random
import time
import threading
from queue import Queue
import collections
class AsynchronousFileReader(threading.Thread):
'''
View README.md

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 Dec 29, 2018
Circle of Fifths with Diatonic Seventh Chords
View .block
license: mit
height: 800
border: no
@soxofaan
soxofaan / signal_catcher_context.py
Last active Apr 13, 2019
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.
View signal_catcher_context.py
import logging
import os
import signal
import time
log = logging.getLogger(__name__)
class SignalCatcher:
@soxofaan
soxofaan / index.html
Last active May 14, 2019
d3-plugins sankey cycle support
View index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="./sankey.js"></script>
<title>Sankey Diagram</title>
<style>
View data07-big-with-cycle.js
sankeyDraw(
{
'nodes': [
{name: "a"},
{name: "b"},
{name: "c"},
{name: "d"},
{name: "e"},
{name: "f"},
{name: "g"},
You can’t perform that action at this time.