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 | |
# TUMBLON | |
# | |
# With Tumblr shutting down, I wanted to at least keep some semblance | |
# of the experience of Tumblr around. Since I was able to download | |
# all of my tumblr blogs into separate local repos thanks to | |
# Beat Bolli's wonderful tumblr_backup tool | |
# (https://github.com/bbolli/tumblr-utils/blob/master/tumblr_backup.md), | |
# I just wanted it to spit out a few random images everyday I could |
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 | |
# GIT-RBAGO | |
# | |
# For any given git repository, this script will print out the | |
# (default) ten _most recently worked on_ branches, along with a | |
# fairly human-readable version of how long ago that was. | |
# | |
# Example: | |
# |
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 | |
# This is the current script I use to configure my laptop and my old | |
# desktop monitor. My old monitor is an Acer H243, released in 2009, | |
# maximum resolution 1920x1200. The laptop is crazy modern huge, | |
# 3840x2160. This script picks out the identities of the monitors in | |
# xrandr, and their maximal resolutions, and then rescales the content | |
# so that the two monitors are displaying their best output. | |
# This code makes a lot of assumptions. It assumes that your external |
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
use std::fmt; | |
enum FizzBuzzOr { | |
Fizzbuzz(&'static str), | |
Or(i32) | |
} | |
impl fmt::Display for FizzBuzzOr { | |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
use FizzBuzzOr::*; |
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 is the "Write a Deque" exercise from SICP, section 3.3. | |
; | |
; It took me THREE DAYS to get this right, and in the end, you know what | |
; really made the difference? Doing it on paper. Once I'd written out | |
; all the actions and in text described what I intended to do, this took | |
; less than an hour to put together. | |
; | |
; This is my lesson: ALWAYS, ALWAYS, ALWAYS describe the algorithm, no | |
; matter how simple, on paper first. ALWAYS explain it to your rubber | |
; duck first: https://selftaughtcoders.com/rubber-duck-debugging/ |
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 nodejs | |
// ffoxsession is a little utility to dump the contents of your last | |
// known firefox session. Works with 52 through 60 (so far). Requires | |
// the lz4json utility (https://github.com/andikleen/lz4json), as | |
// Firefox uses some weird version of lz4 optimized for JSON data. | |
var fs = require("fs"); | |
var os = require("os"); |
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 filename as its required argument. The file should contain | |
names from a sample list, one name per line. It creates a Markov | |
chain of one, two, and three-letter character sequences, including | |
octothorpe-anchored sequences for the starts of names. It then | |
generates 'n' random names, each using the probabistic distribution of | |
three-letter character sequences, to make names that match the | |
patterns fed in the original. |
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
// I was really annoyed that I couldn't easily assert that a | |
// straightforward enum was being matched. I'm sure there's a better | |
// way to do this but, hey, this is my first Rust macro. | |
macro_rules! assert_is_enum { | |
($left:expr, $right:path) => ({ | |
match &$left { | |
left_val => | |
if let $right = *left_val { } | |
else { |
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 | |
# This file implements Brzozowski's parsing-with-derivatives (see: | |
# https://arxiv.org/abs/1604.04695) with fairly simple and | |
# straightforward Python code. This implementation is naive and | |
# subject to exponential memory growth in the worst case; in practice, | |
# average complexity is closer to linear. This version recalculates | |
# derivatives every time they are needed; memoization, the first and | |
# most obvious optimization, is not implemented. | |
# |
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 hy | |
; This script requires `pip install slugify newspaper`. It runs on Hy 0.12 and Python 3.5. | |
; This is part of an (incomplete) xinetd-driven toolchain for managing local bookmarks. | |
(import sys os os.path [slugify [slugify]] [newspaper [Article]]) | |
(def bookmark-index | |
(os.path.join (get os.environ "HOME") "Wiki" "Bookmarks" "Bookmarks.org")) |