Skip to content

Instantly share code, notes, and snippets.

@jgrodziski
jgrodziski / watch.sh
Created February 26, 2021 16:46
File Watcher
#!/bin/bash
fswatch -o $1 | xargs -n1 -I{} /usr/bin/env bash -c "echo Reloading $2; ~/bin/reload-browser.sh $2" reload
@jgrodziski
jgrodziski / karabiner.json
Last active May 31, 2020 20:34
karabiner elements - shift press alone as parenthesis
//add these 2 rules in ~/.config/karabiner/karabiner.json under profiles/complex_modifications/rules
{
"description": "Change left_shift to left parens if alone.",
"manipulators": [
{
"from": {
"key_code": "left_shift",
"modifiers": {
"optional": [
"any"
@jgrodziski
jgrodziski / reload-browser.sh
Last active April 21, 2024 01:36
Automatic live reload of browser page after file(s) change
#!/bin/bash
osascript <<EOF
tell application "Google Chrome"
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
repeat with atab in tabList
if (URL of atab contains "$1") then
tell atab to reload
(ns promesa-retry
(:require
["util" :refer [format]]
[promesa.core :as p :refer [reject! resolve!] :refer-macros [alet await]]
[promesa.async-cljs :refer-macros [async]]
[cljs.test :as t :include-macros true]))
(defn backoff-duration [retries-count interval]
(+ (* interval retries-count) (rand-int interval)))

From https://github.com/ESWAT/john-carmack-plan-archive/blob/master/by_day/johnc_plan_19981014.txt Layout - like bold - is my own.

It has been difficult to write .plan updates lately. Every time I start writing something, I realize that I'm not going to be able to cover it satisfactorily in the time I can spend on it. I have found that terse little comments either get misinterpreted, or I get deluged by email from people wanting me to expand upon it.

I wanted to do a .plan about my evolving thoughts on code quality and lessons learned through quake and quake 2, but in the interest of actually completing an update, I decided to focus on one change that was intended to just clean things up, but had a surprising number of positive side effects.

Since DOOM, our games have been defined with portability in mind. Porting to a new platform involves having a way to display output, and having the platform tell you about the various relevant inputs. **There are four principle inputs to a game: keystrokes, mouse moves

; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
#!/bin/bash
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo bash -c "echo JAVA_HOME="/usr/lib/jvm/java-8-oracle" >> /etc/environment"
java -version
@jgrodziski
jgrodziski / postgres.clj
Last active October 1, 2023 13:00
Hugsql automatic renaming keys from "snake" to "kebab" using postgres.async and core.async channels
(def xform (map (partial transform-keys ->kebab-case-keyword)))
(defn result-one-snake->kebab
[this result options]
(let [return-chan (chan)]
(pipeline 1 return-chan xform (result-one this result options))
return-chan))
(defmethod hugsql.core/hugsql-result-fn :1 [sym] 'org.myapp.db.postgres/result-one-snake->kebab)
(defmethod hugsql.parameters/apply-hugsql-param :i [param data options] 'org.myapp.db.postgres/result-one-snake->kebab)

Keybase proof

I hereby claim:

  • I am jgrodziski on github.
  • I am jgrodziski (https://keybase.io/jgrodziski) on keybase.
  • I have a public key whose fingerprint is 5A99 EE65 A0A4 7587 5EB1 EC89 C915 208B FDD0 637E

To claim this, I am signing this object:

@jgrodziski
jgrodziski / settings.xml
Created September 10, 2017 16:00
maven settings.xml including clojars repo
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>