View gen.rb
This file contains 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
exprs = File.readlines('input') | |
.map { |l| " (seq.unit \"#{l.chomp}\")" } | |
.join("\n") | |
smt2 = File.read('tpl.smt2') | |
.sub('%EXPRS%', exprs) | |
File.write('out.smt2', smt2) |
View day1-part2.smt
This file contains 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
(set-logic QF_ALIA) | |
(declare-const len Int) | |
(assert (= len 247)) | |
(declare-const a (Array Int Int)) | |
(define-fun x () (Array Int Int) | |
(store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store (store |
View part2-tpl.smt2
This file contains 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
(set-logic AUFLIA) | |
(declare-sort RPS 0) | |
(declare-fun rock () RPS) | |
(declare-fun paper () RPS) | |
(declare-fun scissors () RPS) | |
(declare-sort OUTCOME 0) | |
(declare-fun win () OUTCOME) | |
(declare-fun lose () OUTCOME) |
View model100.ino
This file contains 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
// -*- mode: c++ -*- | |
#include "Kaleidoscope.h" | |
#include "Kaleidoscope-Macros.h" | |
#include "Kaleidoscope-LEDControl.h" | |
#include "Kaleidoscope-LEDEffect-BootGreeting.h" | |
#include "Kaleidoscope-LED-Stalker.h" | |
#include "Kaleidoscope-SpaceCadet.h" | |
// Macros |
View Model100.ino
This file contains 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
// -*- mode: c++ -*- | |
#include "Kaleidoscope.h" | |
#include "Kaleidoscope-Macros.h" | |
#include "Kaleidoscope-LEDControl.h" | |
#include "Kaleidoscope-LEDEffect-BootGreeting.h" | |
#include "Kaleidoscope-LED-Stalker.h" | |
#include "Kaleidoscope-SpaceCadet.h" | |
// Macros |
View lrl
This file contains 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
#!/bin/bash | |
set -euo pipefail | |
plists=() | |
while read -r pl; do | |
plists+=("${pl}") | |
done < <(ls ~/Library/LaunchAgents) | |
len=${#plists[@]} | |
height=$((len + 2)) |
View onchange
This file contains 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 ruby | |
require('open3') | |
extra_fswatch_args, cmd_args = if (rest_index = ARGV.index('--')) | |
[ARGV[0...rest_index], ARGV[rest_index+1..-1]] | |
else | |
[[], ARGV] | |
end |
View 0.zsh
This file contains 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
# fragment added to ~/.zshrc | |
zle-gasdf() { gasdf; zle .beginning-of-line; zle .kill-line; zle .accept-line } | |
zle -N zle-gasdf | |
bindkey 'å' zle-gasdf # Alt-A Canadian English |
View json_type.rb
This file contains 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
class JSONTypeClass < T::Types::Base | |
ScalarType = T.type_alias { T.any(String, Numeric, NilClass, FalseClass, TrueClass) } | |
IterType = T.type_alias { T.any(ScalarType, T::Array[T.untyped], T::Hash[String, T.untyped]) } | |
def name | |
'JSON' | |
end | |
def valid?(obj) | |
# in this particular case I don't think it makes sense to distinguish |
View 0test.rb
This file contains 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
assert(JSONType.recursively_valid?({'a' => ['neato']})) | |
refute(JSONType.recursively_valid?({'a' => [:neato]})) |
NewerOlder