Skip to content

Instantly share code, notes, and snippets.

View whacked's full-sized avatar

whacked

  • let's do something cool together.
  • sillycon belly
View GitHub Profile
@whacked
whacked / flake.nix
Created October 15, 2023 09:05
fancy nix environment that works with cuda 11+
{
nixConfig.bash-prompt = ''\033[1;32m\[[nix-develop:\[\033[36m\]\w\[\033[32m\]]$\033[0m '';
inputs = {
# doesn't provide cuda_12_2
# leaving this blank most likely loads whatever is on the system
# nixpkgs.url = "github:nixos/nixpkgs/23.11-pre";
whacked-setup = {
url = "github:whacked/setup/6b73eed531bdf4fde58a8214a94d11c4e024082e";
flake = false;
@whacked
whacked / generate-obsidian-canvas-graph.py
Created December 22, 2022 11:11
generate graphs to test obsidian canvas
import sys
import json
import random
import math
if len(sys.argv) >= 3:
num_rows = int(sys.argv[1])
num_columns = int(sys.argv[2])
else:
num_rows = 20
@whacked
whacked / quiet.nix
Last active November 27, 2021 16:28
nix shell env to build https://github.com/quiet/quiet
{ pkgs ? import <nixpkgs> {} }:
let
libfec = pkgs.stdenv.mkDerivation rec {
pname = "libfec";
version = "0.0.1";
src = pkgs.fetchFromGitHub {
owner = "quiet";
repo = "libfec";
rev = "master";
@whacked
whacked / css_to_garden.clj
Created September 19, 2020 03:53
quick and very-dirty css -> garden transformer. not complete! but will save 95% effort from hand-conversion
#!/usr/bin/env bb
(def input-file
(or (first *command-line-args*)
"defaults.css"))
(defn parse-css [text]
(let [render-buffer (fn [buf]
(apply str buf))]
(loop [ch-remain text
import atexit
import datetime
import time
import co2meter
import json
import subprocess as subp
import logging
logger = logging.getLogger()
@whacked
whacked / default.nix
Last active August 19, 2019 03:30
attempt a quick fix for broken epdfinfo in pdf-tools for nix-provided emacs
# ref https://www.reddit.com/r/NixOS/comments/6dvm04/how_to_install_emacs_pdftools_with_epdfinfo/di5yii9/
# git clone https://github.com/politza/pdf-tools
# run this from within
# then M-x package-install-file
# select the .tar from the `make` output; the epdfinfo is broken.
# then cp the patchelf-ed version into emacs
with (import <nixpkgs> {});
stdenv.mkDerivation {
@whacked
whacked / swap-timing.cljs
Created June 30, 2019 21:20
quick and dirty timing test of clojurescript atom update times: 3 separate atoms, 1 atom, 1 atom + cursors; native atoms and reagent atoms
;; tl;dr: separate atoms is the fastest (1.0x), followed by single atom (1.21x), then separate r/cursors (2.20x)
;; `atom` and `r/atom` have basically equivalent performance when used as-is.
;; the deeper the cursor, the slower the swap.
(let [make-atom r/atom ;; or atom
N 1000000
my-atom1 (make-atom 0)
my-atom2 (make-atom {:nodes [{:id 1} {:id 2}]})
my-atom3 (make-atom {:app-state {:display {:level5 "oliver"}}})
@whacked
whacked / container-install.sh
Created May 11, 2019 21:49
container test stuff (old)
if false; then
sudo apt-get update
sudo apt-get install -y vim git tmux terminator
# rkt
gpg --keyserver pgp.mit.edu --recv-key 18AD5014C99EF7E3BA5F6CE950BDD3E0FC8A365E
wget https://github.com/rkt/rkt/releases/download/v1.26.0/rkt_1.26.0-1_amd64.deb
wget https://github.com/rkt/rkt/releases/download/v1.26.0/rkt_1.26.0-1_amd64.deb.asc
gpg --verify rkt_1.26.0-1_amd64.deb.asc
@whacked
whacked / container-install.sh
Created May 11, 2019 21:49
container test stuff (old)
if false; then
sudo apt-get update
sudo apt-get install -y vim git tmux terminator
# rkt
gpg --keyserver pgp.mit.edu --recv-key 18AD5014C99EF7E3BA5F6CE950BDD3E0FC8A365E
wget https://github.com/rkt/rkt/releases/download/v1.26.0/rkt_1.26.0-1_amd64.deb
wget https://github.com/rkt/rkt/releases/download/v1.26.0/rkt_1.26.0-1_amd64.deb.asc
gpg --verify rkt_1.26.0-1_amd64.deb.asc
diff --git a/run.sh b/run.sh
index 46d9020..36e2e98 100755
--- a/run.sh
+++ b/run.sh
@@ -145,7 +145,7 @@ for pfile in .bashrc .bash_profile; do
grep -v nix-profile |
grep -v nix-venv-shell |
cat > ${HOME}/${pfile}
- echo 'function nix-enable() { unset LD_LIBRARY_PATH; . $HOME/.nix-profile/etc/profile.d/nix.sh; $* };' >> ${HOME}/${pfile}
+ echo 'function nix-enable() { unset LD_LIBRARY_PATH; . $HOME/.nix-profile/etc/profile.d/nix.sh; $*; };' >> ${HOME}/${pfile}