Skip to content

Instantly share code, notes, and snippets.

@jasonrobot
jasonrobot / hyperfocals.rb
Last active September 30, 2022 17:30
calculate hyperfocal distances
#!/usr/bin/env ruby
require "optparse"
# default values for command line args
focal_length = 50
apertures = [16, 11, 8, 5.6]
circle_of_confusion = 0.03
use_feet = false
@jasonrobot
jasonrobot / init.el
Last active January 19, 2022 20:06
my emacs config!
;;; package --- init.el
;;; Commentary:
;;; Code:
;; do this, since I usually run fish
(setq shell-file-name "/bin/bash")
;;;;;;;;;;;;;;
;; Packages ;;
@jasonrobot
jasonrobot / archive-photos.rb
Created May 5, 2021 21:10
A ruby script to archive a bunch of folders of photos using 7zip
#!/usr/bin/env ruby
require 'date'
index = 1
date = Date.today.to_s
ARGV.each do |dirname|
dirname += '/' unless dirname.end_with? '/'
# puts "7z a #{date}.#{index}.7z #{dirname}*.jpg"
#!/usr/bin/env ruby
# foo_bar-qwe_asd/01.name.flac
require 'fileutils'
start_dir = Dir.pwd
ARGV.select do |arg|
# is a directory
average damage given stat scores 1-20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
scorching ray: 20.00 21.00 21.00 20.00 20.00 19.00 18.00 17.00 17.00 15.00 14.00 13.00 12.00 11.00 10.00 9.00 8.00 7.00 6.00 5.00
shatter: 12.58 12.52 12.57 12.07 12.28 11.69 11.73 11.40 11.23 11.20 11.13 10.86 10.87 10.32 10.72 10.28 10.23 9.92 9.95 9.52
dragon breath: 10.07 9.74 9.72 9.55 9.23 9.15 9.17 8.97 8.87 8.66 8.80 8.27 8.47 7.99 8.00 7.84 7.96 7.51 7.62 7.32
guard: Level 3, AC: 16
STR: ?, DEX: 12, CON: 12, INT: ?, WIS: ?, CHA: ?
scorching ray: 9
shatter: 11.0055
@jasonrobot
jasonrobot / make-csv.cr
Last active January 23, 2020 18:06
Needed some sample people in a csv file, so gave it a try with Racket. Not bad!
module MakeContacts
extend self
@@onset_list = ["m", "n", "p", "t", "ch", "k", "c", "b", "d", "j", "g", "f", "th", "s", "sh", "h", "v", "l", "r", "w", "pl", "bl", "cl", "gl", "pr", "br", "tr", "dr", "cr", "fl", "sl", "fr", "sm", "sn"]
@@nucleus_list = ["a", "e", "i", "o", "u", "y", "ae", "ai", "au", "ea", "ee", "ei", "ia", "ie", "io", "oa", "oe", "oi", "oo", "ou", "oy", "ue", "ui", "uo"]
@@coda_list = ["m", "n", "p", "t", "ch", "k", "b", "d", "y", "g", "f", "s", "sh", "v", "l", "r", "mb", "mp", "nd", "nt", "nch", "nge", "pt", "tch", "ts", "tsh", "lm", "ln", "lp", "lt", "ld", "lge", "lf", "ls", "rm", "rn", "rp", "rt", "rk", "rb", "rd", "rge", "rf", "rs"]
def get_random_from_list(l)
l[Random.rand(l.size)]

Considerations for the top 10

Most listened albums in Google Music Compositional quality of the album as a whole. Personal, historical attachment to the band or album. Comparison to other albums that are being considered.

The top 10, in no order

  • Intronaut - Direction of Last Things

What can I say, I'm crazy about Intronaut. I found this album in 2015, just after getting back in to programming, so it has a bit of recent sentimentality to it for me too. It's also just a fantastic album.

@jasonrobot
jasonrobot / demo.js
Last active December 4, 2019 22:33
A little demonstration of Ramda
import * as R from 'ramda'
// Setting up some date to play with
const foo = {
validate() {
return this.x < 69 && (typeof this.name === 'string');
},
x: 420,
name: Symbol('lul')
}
@jasonrobot
jasonrobot / markdown.md
Created August 29, 2019 05:58
markdown vs org

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one
@jasonrobot
jasonrobot / custom.el
Last active July 13, 2019 05:25
emacs configs because I'm too lazy to use real git
;;; package --- Summary
;; its not a package, its just all my customs
;;; Commentary:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; custom-set-variables - Dont edit below here! ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;