Skip to content

Instantly share code, notes, and snippets.

@milo-trujillo
milo-trujillo / generateBSPDungeon.py
Created May 21, 2023 23:29
Toy program to make little nethack-style dungeons exported as tikz figures
#!/usr/bin/env python3
import random
BUFFER = 2
# For exporting the map as a tikz diagram
PREAMBLE = r'''\documentclass[tikz,convert=pdf2svg]{standalone}
\usepackage[utf8]{inputenc}
\usetikzlibrary{backgrounds}
@milo-trujillo
milo-trujillo / update-folder.rb
Created October 5, 2020 16:55
Currently working in an awkward environment where files are located across several drives and must be symlinked together to create the illusion of a single web-hosted folder. This script automates the process.
#!/usr/bin/env ruby
sourceFolder="/tmp/a"
destinationFolder="/tmp/b"
updated = 0
puts "Checking for unreferenced files in #{sourceFolder}..."
for file in Dir.glob(sourceFolder + "/*")
base = File.basename(file)
destination = "#{destinationFolder}/#{base}"

Keybase proof

I hereby claim:

  • I am milo-trujillo on github.
  • I am atrus (https://keybase.io/atrus) on keybase.
  • I have a public key ASC_Snd7MHBd5igU9jx6VHyIQgDGwHrzRrKbXhCOI90wGQo

To claim this, I am signing this object:

@milo-trujillo
milo-trujillo / makeThumbs.sh
Created June 2, 2017 07:06
Create website thumbnails for a folder of PNGs
#!/usr/bin/env bash
# Creates thumbnails for a folder of PNGs
width=300
for file in "."/*.png
do
filename=$(basename "$file")
filename="${filename%.*}"
@milo-trujillo
milo-trujillo / captcha.rb
Created May 25, 2017 03:42
Captchas, on the command-line!
#!/usr/bin/env ruby
# Terrible idea requires "figlet" to be installed
Fonts = ["small", "mini", "script", "standard", "slant", "banner"]
Letters = ('a'..'z').to_a.shuffle[0,rand(8..12)].join
Text = `figlet -f #{Fonts.sample(1)[0]} #{Letters}`
puts "Captcha:"
puts "#{Text}"