Skip to content

Instantly share code, notes, and snippets.

View Ramblurr's full-sized avatar

Casey Link Ramblurr

View GitHub Profile
@Ramblurr
Ramblurr / dynamic-wallpaper.nix
Created March 27, 2024 07:50
nixfmt breaking this file
# Source: https://github.com/b3nj5m1n/dotfiles/blob/1da98eb2745ea4b0e4b789c38a037080bbf8347f/nix/modules/nixos/dynamic-wallpaper.nix#L8
# (C) https://github.com/b3nj5m1n
# License: AGPL v3
{
pkgs,
config,
lib,
...
}:
with lib; let
@Ramblurr
Ramblurr / browser.clj
Created October 6, 2023 09:00
Refresh a chrome tab from your clj repl
(ns browser
(:require [etaoin.api :as eta] ;; https://clojars.org/etaoin
[clojure.core.async :as async]))
(defn debounce [in timeout-atom]
(let [out (async/chan)]
(async/go-loop [last-val nil]
(let [val (if (nil? last-val) (async/<! in) last-val)
ms @timeout-atom
timer (async/timeout ms)
@Ramblurr
Ramblurr / raspberry-pi-zero-2.nix
Created September 3, 2023 16:25 — forked from plmercereau/raspberry-pi-zero-2.nix
Nix module to create SD images for Rasperry Pi Zero 2 W
{ config, lib, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix>
./sd-image.nix
];
system.stateVersion = "23.11";
# Pi Zero 2 struggles to work without swap
sdImage.swap.enable = true;
@Ramblurr
Ramblurr / secret_box.clj
Created January 19, 2023 09:22
Simple encrypt/decrypt functions in clojure using AES GCM and argon2id key derivation.
(ns secret-box
(:import
org.bouncycastle.crypto.generators.Argon2BytesGenerator
org.bouncycastle.crypto.params.Argon2Parameters
org.bouncycastle.crypto.params.Argon2Parameters$Builder)
(:require
[taoensso.nippy :as nippy]
[buddy.core.crypto :as crypto]
[buddy.core.codecs :as codecs]
[buddy.core.nonce :as nonce]))
@Ramblurr
Ramblurr / imgur-cleanup.js
Created November 24, 2017 10:35
Imgur: Mobile Cleanup
// ==UserScript==
// @name Imgur: Mobile Cleanup
// @namespace https://github.com/Zren/
// @description Cleanup m.imgur.com and always load all images in the album.
// @icon https://imgur.com/favicon.ico
// @author Zren
// @version 2
// @include https://m.imgur.com/*
// @grant GM_addStyle
// ==/UserScript==
@Ramblurr
Ramblurr / probenplan.py
Last active June 4, 2022 09:55
a quick script to generate a reherseal schedule for a street band
from itertools import cycle
from datetime import date, timedelta
import random
import math
from tabulate import tabulate
# How many weeks should we generate a probenplan for?
weeks = 6
# What date does the first probe start on?
! https://raw.githubusercontent.com/arosh/ublacklist-github-translation/master/uBlacklist.txt
! Github fake
*://bleepcoder.com/*
*://githubja.com/*
*://*.gitmemory.com/*
*://giters.com/*
*://githubmemory.com/*
*://*.wenyanet.com/*
*://issueexplorer.com/*
*://opensourcelibs.com/*
@Ramblurr
Ramblurr / next-jdbc-sqlite-datetimes.clj
Last active October 27, 2021 14:41
Clojure next.jdbc and SQLite datetime goodness
;; problem: date, time, datetime, and timestamp types in sqlite are basically just strings or numbers.
;; the sqlite jdbc driver doesn't coerce them into Timestamp, Date or Time types by default
;; but we want to use proper java.time types!
;;
;; solution: supply a builder-fn [0] that correctly returns java.sql.{Date,Time,Timestamp} types (and Boolean while were at it)
;;
;; [0]: https://cljdoc.org/d/seancorfield/next.jdbc/1.2.659/doc/getting-started/tips-tricks#sqlite
(def builder-fn
(next.jdbc.result-set/builder-adapter
@Ramblurr
Ramblurr / find_iface.yml
Created October 28, 2020 13:31
Ansible find interface name given an ip address on Linux and FreeBSD
---
# Answer from Vladimir Botka @ https://serverfault.com/questions/1040246/how-to-select-network-interface-given-ip-address-in-ansible-across-debian-and-fr/1040273#1040273
# Tested on Ansible 2.10
# can this be simplified? Watch https://github.com/ansible/ansible/issues/69638
- name: find interface name assigned given ip address
hosts: all
vars:
ip_find_iface: "10.1.0.51"
freebsd_query: >-