This file contains hidden or 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 bash | |
set -eou pipefail | |
# This script takes/generates a Wireguard private/public key pair, registers it with CloudFlare's WARP | |
# service, and outputs a Wireguard config file. | |
# Adapted from @saurik's script here: https://twitter.com/saurik/status/1176893448445558784 | |
if [ "$#" -gt 0 ] && [ "$1" = "--help" ]; then | |
echo "Creates a Wireguard config file for CloudFlare's WARP service." |
This file contains hidden or 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 python3 | |
""" | |
Takes a file full of Spotify track URLss and prints their artists and track | |
names to stdout. Useful for converting a spotify playlist export to a list of | |
human-readable songs. | |
File format: | |
``` | |
https://open.spotify.com/track/<track id> |
This file contains hidden or 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/sh | |
# Requires: audiowaveform (https://github.com/bbc/audiowaveform), metaflac, sox | |
zoom_start=60 | |
zoom_duration=4 | |
zoom_end=$((zoom_start + zoom_duration)) | |
if [ $# -lt 1 ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then | |
echo "Generates spectrogram and waveform images from flac files" |
This file contains hidden or 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/sh | |
# Don't worry about merge commits | |
if [ -f .git/MERGE_MSG ]; then | |
exit 0 | |
fi | |
# Get first non-comment line of the commit message | |
fl=$(sed '/^#.*/d' $1 | head -1) |
This file contains hidden or 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
def compare(x, y): | |
if x == y: | |
return 0 | |
try: | |
if x < y: | |
return -1 | |
else: | |
return 1 | |
except TypeError as e: | |
# The case where both are None is taken care of by the equality test |
This file contains hidden or 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/sh | |
read oldrev newrev refname | |
NULL_SHA1="0000000000000000000000000000000000000000" | |
revs="" | |
case $oldrev,$newrev in | |
*,$NULL_SHA1) # Deleting ref | |
;; |
This file contains hidden or 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 os | |
import zipfile | |
import io | |
import logging | |
def zip_paths(paths): | |
""" | |
Compresses directories and files to a single zip file. | |
Returns the zip file as a data stream, None if error. |
NewerOlder