Skip to content

Instantly share code, notes, and snippets.

@kylejohnston
kylejohnston / gist:14f1224f30c2fd60d62f0645d8c09110
Created March 5, 2026 20:15
Karabiner rule: caps lock = hyper key ¦ single-tap=f12, long-press=f8
{
"description": "caps lock = hyper key ¦ single-tap=f12, long-press=f8",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 300,
@kylejohnston
kylejohnston / gist:d403ca7887b482be771e62ebe049ee41
Created March 5, 2026 00:41
Karabiner Rule: caps l caps lock → hyper key ¦ double-tap=f12, long-press=f8
{
"description": "caps lock → hyper key ¦ double-tap=f12, long-press=f8",
"manipulators": [
{
"conditions": [
{
"name": "hyper_caps_tap",
"type": "variable_if",
"value": 1
}
@kylejohnston
kylejohnston / add-date.sh
Created March 15, 2025 16:56
On macOS, this script uses renames a file by appending the file's created date. For example, a file named IMG_000.jpg with a created date of Wednesday, January 1, 2025 at 10:09 AM would be renamed to 2025-01-01 IMG_000.jpg
#!/bin/bash
# Function to rename a file with its creation date prefix
rename_with_date() {
local file="$1"
# Skip if the file doesn't exist
if [ ! -f "$file" ]; then
echo "Error: File '$file' not found"
return 1
@kylejohnston
kylejohnston / northern-lights.pde
Last active January 25, 2025 22:54
A soothing processing sketch. Preview the output here: https://www.youtube.com/watch?v=k3yddvs_8aU
// preview the output here: https://www.youtube.com/watch?v=k3yddvs_8aU
// requires the Hype Processing Library
// https://github.com/hype/HYPE_Processing
import hype.*;
import hype.extended.behavior.HOscillator;
import hype.extended.colorist.HColorPool;
import hype.extended.layout.HPolarLayout;
// sketch variables
int stageW = 800;
@kylejohnston
kylejohnston / sample.code-workspace
Created April 25, 2020 00:56
VS Code Workspace
// Assumes this file is in ~/Sites/_workspaces
// The settings customize the color of the title bar
{
"folders": [
{
"path": "../folder-name"
}
],
"settings": {
"workbench.colorCustomizations": {
@kylejohnston
kylejohnston / hype_environment.sublime-snippet
Created March 26, 2019 08:13
A starter environment for projects using Processing and the HYPE framework
<snippet><content><![CDATA[
${1:import processing.pdf.*;}
import hype.*;
// ENVIRONMENT VARIABLES *************************************************
// Screen: 1440×900; Dribbble: 800×600; HD: 1920×1080 or 960×540)
int stageW = 800;
int stageH = 600;
color clrBG = #242424;
@kylejohnston
kylejohnston / hype.sublime-completions
Created October 14, 2018 17:16
Sublime completions for the Hype Frameworks extended classes
{
"scope": "source.pde",
"completions":
[
// behaviors
{ "trigger": "HAttractor", "contents": "import hype.extended.behavior.HAttractor;" },
{ "trigger": "HAttracted", "contents": "import hype.extended.behavior.HAttractor.HAttracted;" },
{ "trigger": "HAttractionForce", "contents": "import hype.extended.behavior.HAttractor.HAttractionForce;" },
{ "trigger": "HFollow", "contents": "import hype.extended.behavior.HFollow;" },
{ "trigger": "HMagneticField", "contents": "import hype.extended.behavior.HMagneticField;" },
@kylejohnston
kylejohnston / processing.sublime-completions
Last active October 14, 2018 17:17
Hype Framework - Sublime Completions
{
"scope": "source.pde",
"completions":
[
// push pop matrix
{ "trigger": "push|pop|matrix", "contents": "\tpushMatrix();\n\t\ttranslate($1,$2,$3);\n\t\trotateX(radians($4));\n\t\trotateY(radians($5));\n\t\trotateZ(radians($6));\n\n\tpopMatrix();\n" },
// hello world
{ "trigger": "hello|world", "contents": "Hello World!" }
]
}
@kylejohnston
kylejohnston / hype_img.sublime-snippet
Last active May 20, 2021 23:05
Sublime snippet for generating images from Processing + HYPE PDEs
<snippet><content><![CDATA[
// NOTE: set transparent background with H.CLEAR
// PLACE BEFORE CLOSING BRACE IN VOID SETUP()
saveHiRes(1); // define the scale factor
noLoop();
} // CLOSE VOID SETUP()
void draw() {
H.drawStage();
}
@kylejohnston
kylejohnston / hype_pdf.sublime-snippet
Created September 29, 2018 05:26
Sublime snippet for generating PDFs from Processing + HYPE PDEs
<snippet><content><![CDATA[
// MOVE TO LINE 1
import processing.pdf.*;
// PLACE BEFORE CLOSING BRACE IN VOID SETUP()
saveVector();
noLoop();
} // CLOSE VOID SETUP()
void draw() {
H.drawStage();