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 | |
if test $# = 0 ; then | |
echo "Usage: $0 <sleep interval like 15m>" | |
exit 1 | |
fi | |
while true | |
do | |
echo "Randomizing MAC now" | |
spoof-mac randomize en0 |
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
--[[ Usage | |
Windows: | |
lua factorio-recipe-parser.lua "C:/Apps/Factorio/data/base/prototypes/recipe/" | |
Steam on macOS: | |
lua factorio-recipe-parser.lua ~/"Library/Application Support/Steam/steamapps/common/Factorio/factorio.app/Contents/" | |
NB: json.lua is from https://gist.github.com/tylerneylon/59f4bcf316be525b30ab | |
]]-- |
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
# tmp: move files to /tmp instead of removing them outright. | |
# /tmp is cleaned up on reboot or so, so there is time to rectify mistakes. | |
# | |
# Usage: tmp [files or directories...] | |
# batch "do stuff to a file" files... | |
function batch() { | |
p="$1" | |
shift | |
for x in "$@"; do |
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
''' | |
Warning: Turns out parsy is very slow :( | |
Usage: | |
import strace_grammar as grammar | |
for line in strace_output: | |
# not interested in this strace metadata: | |
if line.startswith('strace:'): | |
continue |
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 -eu | |
city=helsinki | |
for type in restaurant sport culture; do | |
for page in {0..5000}; do # limit to 5000 queries on failure. | |
url="https://search.edenred.fi/affiliates?page=${page}&count=30&city=${city}&type=${type}" | |
file=edenred_${type}_${city}_page_${page}.json | |
curl -fL "$url" > "$file" |
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
![Adblock Plus 1.1] | |
! NB: Also add https://gitlab.com/isaakm/Custom-Prebake/raw/master/filterlist.txt | |
! 04/03/2018, 13:08:43 https://sway.com/ | |
sway.com###msccBanner | |
! 04/03/2018, 14:01:30 https://lumo.fi/ | |
lumo.fi###cookie-disclaimer | |
! 11/03/2018, 12:04:06 https://pretix.eu/about/en/ |
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 python | |
'''Create a simple RSS feed for a podcast | |
Usage: python create_feed.py *.m4a | |
Assumes .m4a audio files. Edit MIME type if needed. | |
Depends on feedgen: pip install feedgen | |
''' | |
import sys | |
from feedgen.feed import FeedGenerator |
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
# This creates a pre-emptible VM on Google Cloud with a | |
# more or less NVIDIA approved configuration and drivers | |
# using the public NVIDIA GPU Cloud (NGC) image on GCP. | |
# The VM has nvidia-docker installed so anything like | |
# this will work out of the box: | |
# | |
# $ docker run --runtime=nvidia --rm paperspace/fastai:cuda9_pytorch0.3.1 | |
# | |
# None of the public scripts and info had working configuration anywhere. | |
# Even the "official" sample scripts don't have working default configuration: |
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 | |
# Usage: ndjson_to_csv <files... or stdin> > output.csv | |
# NB: Assumes that each line is a simple JSON object with no nested arrays or objects | |
import csv | |
import json | |
import sys | |
import fileinput | |
from collections import namedtuple, OrderedDict | |
lines = fileinput.input() |
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
# | |
# pip install zstandard | |
# | |
# The zstandard bindings are a little off, compared to gzip, etc. | |
# So small tricks like this are needed to fully decompress a file in-memory: | |
dctx = zstd.ZstdDecompressor() | |
data = b''.join(dctx.read_to_iter(open('foo.zst', 'rb'))) |