Skip to content

Instantly share code, notes, and snippets.

View ajs's full-sized avatar

Aaron Sherman ajs

View GitHub Profile
[
{
"amount_left" : 5,
"amount_total" : 5,
"frequency" : "Daily",
"id" : 46,
"is_active" : false,
"is_validated" : true,
"item_conditions" :
[
@ajs
ajs / mj_cheat_sheet.md
Last active June 3, 2024 10:14
Midjourney Cheat Sheet

A Cheat Sheet of Midjourney control phrases

[descriptions based on v4]

  • fine ultra-detailed realistic - Can be a bit grainy and "ropey" but increases detail generation
  • ultra photorealistic - Simiar to "fine ultra-detailed realistic"
  • Hasselblad H6D - Sharper focus on subect; shadows are deepened
  • high definition - Shadows are lightened; more fanciful and saturated colors
  • 8k - Lighting tends to be more extreme; colors even more saturated and computer-generated looking than "high definition"
  • cinematic - Shadows tend to be more extreme (though not darker); objects a bit thicker; more poster-like
@ajs
ajs / ajs_dfhack_sheet.md
Last active June 17, 2024 19:13
Dwarf Fortress DFHack and Tips Cheat Sheet

Info

This document pertains to the free version of Dwarf Fortress with DFHack. These commands will not work in the Steam version (yet!)

Useful DFHack Commands

Movement speed

@ajs
ajs / Numericish.pm6
Last active July 23, 2019 03:24
Numericish.pm6
use MONKEY;
role Numericish [::Basis] does Numeric is export {
has Basis $.value;
method new(Basis $value) { self.bless :$value, |%_ }
multi method gist() { "{self.WHAT.perl}({self.value})" }
my @overrides = <
Bool Complex DUMP FatRat Int Num Rat Real Str abs acos
@ajs
ajs / perl6-python-lessons.md
Last active June 3, 2019 14:00
Things I think Python should learn from Perl 6

Some lessons I think Python should learn from Perl 6

I'm not going to wax poetic. I'm a professional Python programmer who has worked with the language for about 10 years and a former Perl 5 developer who also worked with the developers of Perl 6 for a few years.

I have no illusions about Perl 5's ... age, let's say. It was a solid tool for the day, but Python aged well and Perl 5 did not. Perl 6, on the other hand... well, it's a bag of tricks, and not all of those tricks are ones you want played on you. But, I think there are lessons here. Let's get to them.

First the non-lessons

@ajs
ajs / main.p6
Created December 7, 2018 19:57
Perl 6 Simple String Parser Example
# Perl 6 Example from: https://examples.perl6.org/categories/parsers/SimpleStrings.html
# 6pad-ified
# Note: Until this issue is fixed:
# https://github.com/perl6/6pad/issues/2
# You must reload this 6pad between runs, otherwise the
# grammar conflicts with itself as a redefinition.
use v6;
@ajs
ajs / main.p6
Created December 7, 2018 18:48
Perl 6 quicksort demo expanded
use v6;
# Empty list sorts to the empty list
multi quicksort([]) { () }
# Called on a scalar item (not a list of one item) return it as a list
multi quicksort($item) { $item, }
# Otherwise, extract first item as pivot...
multi quicksort([$pivot, *@rest]) {
@ajs
ajs / Perl6-BUILD-caller.txt
Created November 9, 2016 19:05
Test program that shows classes that do not call their BUILD when subclassed
$ perl6 -e 'role Thrower { submethod BUILD(|c) { die; } }; use Test; for <Any Hash Set Int List Routine Mu> -> $name { my $type = ::($name); my $thing = $type.^mixin(Thrower); dies-ok {$thing.new }, "Expect BUILD on ({$thing.perl})" }'
ok 1 - Expect BUILD on (Any+{Thrower})
not ok 2 - Expect BUILD on (Hash+{Thrower})
# Failed test 'Expect BUILD on (Hash+{Thrower})'
# at -e line 1
not ok 3 - Expect BUILD on (Set+{Thrower})
# Failed test 'Expect BUILD on (Set+{Thrower})'
# at -e line 1
@ajs
ajs / default-bug.p6
Created November 7, 2016 17:27
Example of the default setting bug in rakudo perl6
#!/usr/bin/env perl6
#
# Demonstrate a bug in defualt handling. One failure:
#
# ok 1 - My something isa Something
# ok 2 - My something does Pingable
# ok 3 - Something starts at zero
# ok 4 - Ping the something
# ok 5 - Something incremented to 1
# not ok 6 - Starts at zero
@ajs
ajs / ArgTrie.p6m
Created November 3, 2016 17:38
A Trie in perl 6 that can generate a sequence of pairs representing the shortest unique prefix over a set of input words
class ArgTrie is Hash {
# A simple Trie that builds a tree from input words (command-line arguments)
# and can generate a list of unique prefixes mapped to the full words.
has $.count is rw = 0;
method gist() { "\{ count={self.count.gist} {self.pairs.gist} \}" }
method insert(Str $word) {
my $letter = $word.substr(0,1);