Skip to content

Instantly share code, notes, and snippets.

View kyleburton's full-sized avatar

Kyle Burton kyleburton

View GitHub Profile
#!/usr/bin/env bash
set -eEu -o pipefail
# set -x
WORKSPACES="project-web project-admin cider-scratchpad lambda-handler api-tests terraform project-web-tests project-admin-tests"
COMMANDS="urls reset gist shutdown stop workspaces commands all"
function workspace-name-for-abbreviation {
case "$1" in
@kyleburton
kyleburton / az
Last active April 11, 2022 05:16
linux project launcher (eg: az/ht)
#!/usr/bin/env bash
set -eEu -o pipefail
# set -x
WORKSPACES="project-web project-admin cider-scratchpad lambda-handler api-tests terraform cypress-web cypress-admin"
COMMANDS="urls reset gist shutdown stop workspaces commands all"
function workspace-name-for-abbreviation {
case "$1" in
public class Test {
public static String evenOrOdd(int val) {
if (0 == (val % 2)) {
return "even";
}
return "odd";
}
public static String evenOrOdd(long val) {
if (0 == (val % 2)) {
return "even";
/*
* Don't cheat!
*
* javac Foo.java && java Foo
*
*/
public class Foo {
public static void main (String [] args) {
System.out.println("option1\n\n");
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
@kyleburton
kyleburton / google-sheet-script.js
Created August 30, 2019 23:01
counting colored cells in google sheets
// =countbackgrounds("C2:K2","#00ff00")
/*
it's a bit of a hack to send in the cell range as a string, though it works when calling getRange:
SpreadsheetApp.getActiveSpreadsheet().getRange(range)
This also means you can't "fill down" to have the ranges updated to match your sheet, so hack number two genreates
the formulas so you can copy/paste them into the sheet:
(let [chars (->
"01000010 01000101 01000101 01010010"
(.split " ")
vec)
nums (mapv #(Integer/parseInt % 2)
chars)]
(mapv #(-> % char str) nums))
@kyleburton
kyleburton / bot-verbs.txt
Last active November 7, 2023 21:43
The list of 'bot-verbs' that we give to new team members.
Philosophical:
* writing lines of code is one of the least valuable things I can do
* cultivate your impatience
* reject the status quo, unless we can re-derive it from first-principles
* engineers imprint on the first languages (techniuqes, frameworks or technology) that we find success with (unconsciously seen as caregivers, which we defend w/o always knowing why)
* we tend to overvalue the familiar/known; we tend to undervalue the unfamiliar/unknown, this interferes with our receptiveness to new ideas and personal growth
* we're 90% composed of bad habits; many of our best habits become bad as time passes; this allows us to filter for the fundamental; the great
* make doing the right thing easier than any other thing, or we will fail to achieve greatness, or break bad habits
* be conscious, be intentional
* "is this the highest we can aim?" (I prefer this over "is this the best we can do", the former is aspirational, the latter is judgemental)
$meats = %w[fajita-veggie carnitas barbacoa chicken steak]
$rices = ['no-rice', 'white rice', 'brown rice']
$salsas = ['mild salsa', 'medium salsa', 'salsa roja']
$toppings = %w[sour-cream guacamole lettuce cheese]
def gen
ingredients = []
base = $meats[rand($meats.size)] + ' burrito with '
ingredients << $rices[rand($meats.size-1)]
if rand < 0.9
@kyleburton
kyleburton / fizz-buzz.clj
Last active December 10, 2015 11:38
fizz-buzz.clj
;; condition free fizz-buzz solution, based on code from th.vanderveen@gmail.com to the clojure list
;; uses infinite, lazy-sequences
(let [three (cycle [nil nil "fizz"])
five (cycle [nil nil nil nil "buzz"])]
(defn fizz-buzz []
(map vector (iterate inc 1) three five)))
(doseq [tuple (take 30 (fizz-buzz))]
(println (apply str (interpose " " (filter identity tuple)))))