This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function datestrings (date) { | |
const format = ['year', 'month', 'day', 'hour', 'minute', 'second'] | |
const parts = date | |
.toISOString() | |
.split(/[^\d]/g) | |
.slice(0, format.length) | |
.reduce((obj, part, i) => { | |
obj[format[i]] = part | |
return obj | |
}, {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const args = process.argv.slice(2) | |
const key = args[0] | |
if (!key) { | |
console.error('Missing argument') | |
process.exit(1) | |
} | |
let buffer = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create an issue on a Gogs repo specified by pwd's git remote | |
# Exit codes: | |
# 1 : Missing env | |
# 2 : Curl error | |
# 3 : JSON parsing error | |
# Get a key at https://<gogs-server-url>/user/settings/applications | |
api_server="$GOGS_SERVER_URL" | |
api_key="$GOGS_SERVER_API_KEY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Restores ip6tables configuration. | |
# Expected to reject everything BUT: | |
# - icmpv6 from anywhere | |
# - ssh (22/tcp) from a whitelisted ipv6 subnet | |
# - openvpn (1094/udp) from anywhere | |
# | |
# stigok, july 2017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Initiates reconnect of the openvpn process | |
# | |
# Made for /etc/NetworkManager/dispatcher.d/, but should be working | |
# for /etc/network/if-up.d/ as well. | |
# | |
IFACE=$1 | |
ACTION=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Convert a video file to a cross-browser HTML5 video compatible file format | |
# | |
# Usage: vid2html5 <infile> [<outdir>] | |
# | |
# stigok jul 2017 | |
infile="$1" | |
timestamp=`date +'%Y-%m-%d-%H%M%S'` | |
outdir=${2:-.} | |
outfile=$outdir/$timestamp.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Do something after rsync completes | |
# | |
# Usage: after-rsync <srcdir> <command> [...args] | |
set -x | |
srcdir=$1 | |
shift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import dialogs, ugfx, network, badge, deepsleep | |
#import dialogs from micropython/unix/modules/dialogs.py | |
import ugfx, network, badge, time | |
mocked_messages = [ | |
'sshow: hei, verden!', | |
'krav: hello, world!', | |
'sshow: funker dette?', | |
'krav: ja :):):):)', | |
'sshow: hei, verden!', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See /boot/overlays/README for all available options | |
gpu_mem=128 | |
start_file=start_x.elf | |
fixup_file=fixup_x.dat | |
initramfs initramfs-linux.img followkernel | |
# Enable ALSA interface | |
audio=on | |
uart0=off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int SECOND = 1000; | |
const int MINUTE = 60 * SECOND; | |
const int RESOLUTION = 1 * SECOND; | |
//const int EXTRA_TURN_TIME = SECOND; | |
const int GREEN = 0; | |
const int RED = 1; | |
const int DRY_RUN = 1; // Comment this whole line to enable gpio pins |