Skip to content

Instantly share code, notes, and snippets.

View acron0's full-sized avatar
🇬🇧

Antony Woods acron0

🇬🇧
View GitHub Profile
@acron0
acron0 / waitUntilPath.js
Last active September 26, 2024 13:26
GhostInspector "wait until path"
function waitForPath(resolve, reject, targetPath, maxWaitTime = 60000) {
var startTime = Date.now(); // Record the start time
var checkPath = setInterval(function() {
var elapsedTime = Date.now() - startTime;
if (window.location.pathname === targetPath) {
clearInterval(checkPath); // Stop the loop when the condition is met
resolve(`Path is now ${targetPath}`); // Resolve the promise with the target path
}
@acron0
acron0 / retry.ts
Last active September 6, 2024 09:00
Effect retry based on status code
import { Effect, Ref, Either } from 'effect'
import { NodeRuntime } from '@effect/platform-node'
import {
HttpClient,
HttpClientRequest,
} from '@effect/platform'
const MAX_RETRIES = 3
const BAD_TOKEN = 'bad_token'
const isBadToken = (e: Either.Either<unknown, unknown>) =>
@acron0
acron0 / clean.sh
Last active February 5, 2025 16:47
Clean Codespace
#!/usr/bin/env bash
set -x
#
rm -rf /workspaces/.codespaces/shared/editors/jetbrains
rm -rf /workspaces/app/.react-email
rm -rf /workspaces/app/.next/cache
#
rm -f /home/codespace/.local/lib/python3.10/site-packages/torch/lib/libtorch_cpu.so
@acron0
acron0 / keybindings.json
Created July 3, 2023 14:37
keybindings.json
// Place your key bindings in this file to override the defaults
[
// emacs
{
"key": "ctrl+a",
"command": "cursorHome",
"when": "editorTextFocus"
},
{
"key": "ctrl+a",
@acron0
acron0 / clojurebridge-shapes.cljs
Created May 6, 2019 15:13 — forked from londonclojurians/clojurebridge-shapes.cljs
ClojureBridge learning path using Maria.cloud - fork me and explore Clojure using shapes, colours and animation
;; # Colours and Shapes in Clojure
;; This web page allows you to ask your computer to do tasks for you, specifically draw one or more shapes and change the colour of those shapes. We ask the computer to do these tasks in a programming language called Clojure.
;; Clojure is a functional programming language. The behaviour of your code is expressed by calling one or more functions.
;; Each function has a particular thing it does when you call it. We will discover functions that:
;; * draw particular shapes
@acron0
acron0 / bgmmol
Last active April 20, 2024 02:28
i3status widget for displaying my BG mmol
#!/usr/bin/env bash
# 2017-11-20T09:57:46.101+0000 1511171866101 65 Flat xDrip-DexcomG5
LINE=$(curl "https://acron-nightscout.herokuapp.com/api/v1/entries" 2> /dev/null | head -n1 )
TIME_THEN=$(echo $LINE | awk '{ print $2 }' | cut -c -10)
TIME_NOW=$(date +%s)
MMOL=$(echo $LINE | awk '{ print $3 }')
ARROW=$(echo $LINE | awk '{ print $4 }')
MINS_SINCE=$(echo "($TIME_NOW - ${TIME_THEN:-0}) / 60" | bc | xargs printf "%sm ago")
case $ARROW in
Flat) ARROW_SYM="\\u2192"
@acron0
acron0 / keybase.md
Created April 27, 2017 09:44
keybase.md

Keybase proof

I hereby claim:

  • I am acron0 on github.
  • I am acron (https://keybase.io/acron) on keybase.
  • I have a public key ASAatBYeNiG-e78pUELmQLrmlNydCI7yV_SHvAKjOcsJvwo

To claim this, I am signing this object:

(ns automat-play.core
(:require [schema.core :as s]
[automat.core :as a]))
(def ContractOutput
{:witan/schema s/Any
:witan/key s/Keyword
:witan/display-name s/Str})
(def ContractInput
Hit https://packages.gitlab.com trusty InRelease
Hit https://packages.gitlab.com trusty/main Sources
Hit https://packages.gitlab.com trusty/main i386 Packages
Get:1 https://packages.gitlab.com trusty/main Translation-en_GB
Ign https://packages.gitlab.com trusty/main Translation-en_GB
Ign https://packages.gitlab.com trusty/main Translation-en
Reading package lists... Done