Skip to content

Instantly share code, notes, and snippets.

function ssidChangedCallback()
newSSID = hs.wifi.currentNetwork()
if newSSID ~= lastSSID then
hs.alert.show("Wifi Change - Zeroing Volume", 5)
hs.audiodevice.defaultOutputDevice():setVolume(0)
end
lastSSID = newSSID
end
(fn mass->fuel [mass]
(-> (tonumber mass) (/ 3) (math.floor) (- 2)))
(let [file (io.open "1.data" "r")
file-contents (file:read "*a")
mods (string.gmatch file-contents "%d+")]
(var total-fuel 0)
(each [mass mods]
(let [fuel (mass->fuel mass)]
(set total-fuel (+ total-fuel fuel))
(fn mass->fuel [mass]
(-> (tonumber mass) (/ 3) (math.floor) (- 2)))
(let [file (io.open "1.data" "r")
file-contents (file:read "*a")
mods (string.gmatch file-contents "%d+")]
(var total-fuel 0)
(each [mass mods]
(let [fuel (mass->fuel mass)]
(set total-fuel (+ total-fuel fuel))
@jellea
jellea / advent2019-1.fnl
Created December 1, 2019 12:08
Advent Of Code Puzzle 1
(fn mass->fuel [mass]
(-> (tonumber mass) (/ 3) (math.floor) (- 2)))
(let [file (io.open "1.data" "r")
file-contents (file:read "*a")
mods (string.gmatch file-contents "%d+")]
(var total-fuel 0)
(each [mass mods]
(let [fuel (mass->fuel mass)]
(set total-fuel (+ total-fuel fuel))
@jellea
jellea / div.lua
Last active May 4, 2019 21:38
modulo matrix sequencing
-- div
-- modulo matrix sequencing
-- with variable divisions
-- by lijnenspel
--
-- grid needed
-- x = tracks, y = division
-- add samples via param menu
--
-- enc 2
@jellea
jellea / penti.ino
Created January 13, 2019 17:34
Penti chorded keyboard emulation for one half of the Let's Split 40% mech keyboard
#include <Keyboard.h>
#define ROW_NUM 5
#define COL_NUM 6
byte row_pins[5] = { 4, 6, 7, 8, 9 };
byte col_pins[6] = { 10, 16, 14, 15, 18, 19};
byte fingers[5][2] = {{4, 2},{3, 2}, {2, 2}, {1, 2}, {0, 4}}; // [col, row]
char finger_keys[5] = {'A', 'B', 'C', 'D', 'E'};
@jellea
jellea / README.md
Last active June 2, 2020 14:29
Say, a colleague passes you a Figma link, you click it and surprisingly the browser opens, while you have the desktop app installed! You *sigh* and install this script script which adds a question if you want to open web or desktop.

Install

  1. Install Hammerspoon
  2. Install SpoonInstall (unzip and click to install)
  3. Move the contents of appOrWebDialog.lua (question dialog version) or alwaysApp.lua (default to app version) to ~/.hammerspoon/init.lua
  4. Reload Hammerspoon configuration if you already started it.
  5. Set Hammerspoon as default web browser in macOS preferences -> General

Add more apps

  1. Figure out the App Bundle Identifier. Right click "Show Package Contents" on Application and open Contents/Info.plist inside. Find the Bundle Identifier in the plist file.
@jellea
jellea / SketchSystems.spec
Created July 20, 2018 22:06
My Awesome Sketch
My Awesome Sketch
File Selector
select files -> Files selected
Files selected
start -> Processing
Processing
all done? -> results state
results state
unselected*
Editor
Empty Canvas
click Add Chart -> Canvas with Chart
Canvas with Chart
Inspector open*
click Select Data Source -> Data Source Select inspector
Data Source Select inspector
back -> Canvas with Chart
select a Data Source -> Canvas with Chart
click Connect More Data Source -> Modal Marketplace window
Editor
Empty Canvas
click Add Chart -> Canvas with Chart
Canvas with Chart
Inspector open*
click Select Data Source -> Data Source Select inspector
Data Source Select inspector
back -> Canvas with Chart
select a Data Source -> Canvas with Chart
click Connect More Data Source -> Modal Marketplace window