Skip to content

Instantly share code, notes, and snippets.

View danmou's full-sized avatar

Daniel Mouritzen danmou

  • Copenhagen, Denmark
View GitHub Profile
danmou / .inputrc
Created January 21, 2021 12:52
$include /etc/inputrc
# mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
# mappings for Ctrl-left-arrow and Ctrl-right-arrow (big skip)
"\e[1;3C": shell-forward-word
"\e[1;5C": shell-forward-word
"\e[1;3D": shell-backward-word
danmou / gist:b0996994bd65fcf138690e30e95f6902
Created November 12, 2020 17:47
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
import org.jenkinsci.plugins.workflow.job.WorkflowRun
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
danmou /
Created May 11, 2020 20:05
MicroPython script for LED wall clock using ESP8266 and NeoPixels
import time
from neopixel import NeoPixel
from machine import Pin, I2C
from math import floor, ceil
from ntptime import settime
import tsl2561 #
color_m = (0.65, 0.65, 0)
width_m = 2.0
color_h = (0, 0, 1.0)
danmou /
Created December 5, 2019 10:00
Mixin for `tf.keras.layers.Layer`s and subclasses to automatically define input and output specs the first time the model is called.
from typing import Any, Mapping, Optional, Sequence, TypeVar, Union
import tensorflow as tf
from tensorflow.keras import layers
T = TypeVar('T')
Nested = Union[T, Sequence[T], Mapping[Any, T]]
class AutoShapeMixin:
danmou /
Last active May 29, 2024 10:13
Onenote export to HTML. NOTE: This script is now maintained at
# This Python scripts exports all the OneNote notebooks linked to your Microsoft account to HTML files.
## Output
# The notebooks will each become a subdirectory of the `output` folder, with further subdirectories
# for the sections within each notebook and the pages within each section. Each page is a directory
# containing the HTML file `main.html` and two directories `images` and `attachments` (if necessary)
# for the images and attachments. Any sub-pages will be subdirectories within this one.
## Setup
danmou /
Last active November 26, 2018 12:35 — forked from varunagrawal/
Script to sync Taskwarrior after each operation
#!/usr/bin/env python3
# This hooks script syncs task warrior to the configured task server without blocking.
# The on-exit event is triggered once, after all processing is complete.
# Make sure hooks are enabled and this hook script is executable.
# Run `task diag` for diagnostics on the hook.
import sys
import json
#!/usr/bin/env python3
import sys
import base64
import requests
import json
import subprocess
import tempfile
image = tempfile.NamedTemporaryFile().name['gnome-screenshot', '-a', '-f', image, '--display=:0'], check=True)
danmou /
Last active June 10, 2024 08:47
Replacement for the unix wall command, which also works with gnome-terminal
wall [options] [message]
Write a message to all users.
-n, --nobanner do not print banner