Skip to content

Instantly share code, notes, and snippets.

View garvankeeley's full-sized avatar

Garvan Keeley garvankeeley

  • Toronto, ON, CA
View GitHub Profile
[{x:3.5},"# 3",{x:10.5},"* 8"],
[{y:-0.875,x:2.5},"@ 2",{x:1},"$ 4",{x:8.5},"& 7",{x:1},"( 9"],
[{y:-0.875,x:5.5},"% 5",{x:6.5},"^ 6"],
[{y:-0.875,x:1.5},"! 1",{x:14.5},") 0","_ -"],
[{y:-0.995,x:0.5},"~ `",{x:17.5},"+ ="],
[{y:-0.38,x:3.5},"E",{x:10.5},"I"],
[{y:-0.875,x:2.5},"W",{x:1},"R",{x:8.5},"U",{x:1},"O"],
[{y:-0.875,x:5.5},"T","|",{x:4.5}," DEL","Y"],
[{y:-0.875,x:1.5},"Q",{x:14.5},"P","{ ["],
[{y:-0.995,x:0.25,w:1.25}," TAB",{x:17.5},"} ]"],
@garvankeeley
garvankeeley / keyboard.c
Last active December 19, 2024 00:52
Nuphy keyboard config
// qmk compile -kb nuphy/air60_v2/ansi -km via
/// change the caps to KC_RCTL in first layout
// layer 0 Mac
[0] = LAYOUT(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
KC_RCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
import Foundation
import Network
import Combine
struct AuthParams: Encodable {
let staticParam1 = "fixedparam"
let staticParam2 = "anotherfixedparam"
let username: String
let password: String
}
import Foundation
import Network
import Combine
struct AuthParams: Encodable {
let staticParam1 = "fixedparam"
let staticParam2 = "anotherfixedparam"
let username: String
let password: String
}
@garvankeeley
garvankeeley / config.json
Last active February 23, 2021 03:26
karabiner config
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
function kill_zoom()
hs.application.launchOrFocus("zoom.us")
local zoom = hs.appfinder.appFromName("zoom.us")
zoom:kill9()
end
hs.hotkey.bind({"cmd", "alt", "ctrl"}, '/', kill_zoom)
RUSTUP_PLATFORM=x86_64-apple-darwin
RUSTUP_VERSION=1.18.3
RUSTUP_SHA256=16734a9a2d87a3054bd4eea962642687e50a34b6e73e17df6f3361c2c534dc30
curl -sfSL --retry 5 --retry-delay 10 -O "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUSTUP_PLATFORM}/rustup-init"
echo "${RUSTUP_SHA256} *rustup-init" | shasum -a 256 -c -
chmod +x rustup-init
./rustup-init -y --no-modify-path
rm rustup-init
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> $BASH_ENV
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshenv
@garvankeeley
garvankeeley / voip.ms-registration-checker-instructions.md
Last active July 27, 2020 22:07
voip.ms registration checker for mac

This will check every 10 minutes and show a Mac OS notification when the registration is down.

  1. Setup your account on voip.ms for API access
  2. fill in this script, saved as voipms-checker.sh
ACCOUNT='111111'
USER='[email protected]'
PASS='thepass'

if curl --silent "https://voip.ms/api/v1/rest.php?api_username=${USER}&api_password=${PASS}&method=getRegistrationStatus&account=${ACCOUNT}" 2>&1 | grep -qv '"registered":"yes"'; then

Relevant Apple APIs

Scripts are webpacked into 4 JS files, injected at doc start or end for the 'main frame' and 'all frames'.

UserScriptManager.swift performs the injection

use serde_json::Value;
use std::collections::HashMap;
use std::env;
use std::fs;
use std::fs::OpenOptions;
use std::io::prelude::*;
type EntityJSON = HashMap<String, HashMap<String, Value>>; // Company name key to dict which has a resource key with the entities
type BlacklistJSON = HashMap<String, Vec<String>>; // Category to domains in that category