Skip to content

Instantly share code, notes, and snippets.

@jasonrobot
jasonrobot / archive-photos.rb
Created May 5, 2021
A ruby script to archive a bunch of folders of photos using 7zip
View archive-photos.rb
#!/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"
View rename-abcde.rb
#!/usr/bin/env ruby
# foo_bar-qwe_asd/01.name.flac
require 'fileutils'
start_dir = Dir.pwd
ARGV.select do |arg|
# is a directory
View output
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 Jan 23, 2020
Needed some sample people in a csv file, so gave it a try with Racket. Not bad!
View make-csv.cr
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)]
View top 10 of the last 10.md

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 Dec 4, 2019
A little demonstration of Ramda
View demo.js
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')
}
View markdown.md

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 Jul 13, 2019
emacs configs because I'm too lazy to use real git
View custom.el
;;; package --- Summary
;; its not a package, its just all my customs
;;; Commentary:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; custom-set-variables - Dont edit below here! ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
View gist:0955d9ea0e81c9fe925ec1725d4742f4
Every command, function, or variable intended for users to know about should have a documentation string.
An internal variable or subroutine of a Lisp program might as well have a documentation string. Documentation strings take up very little space in a running Emacs.
Format the documentation string so that it fits in an Emacs window on an 80-column screen. It is a good idea for most lines to be no wider than 60 characters. The first line should not be wider than 67 characters or it will look bad in the output of apropos.
Use blank lines between sections if the documentation string is long.
The first line of the documentation string should consist of one or two complete sentences that stand on their own as a summary. M-x apropos displays just the first line, and if that line's contents don't stand on their own, the result looks bad. In particular, start the first line with a capital letter and end it with a period.
View intro.lisp
;;; General form
;;; CL has two fundamental pieces of syntax: ATOM and S-EXPRESSION.
;;; Typically, grouped S-expressions are called `forms`.
10 ; an atom; it evaluates to itself
:thing ; another atom; evaluating to the symbol :thing
t ; another atom, denoting true
(+ 1 2 3 4) ; an s-expression
'(4 :foo t) ; another s-expression