Skip to content

Instantly share code, notes, and snippets.

View dpetranek's full-sized avatar

Daniel Petranek dpetranek

View GitHub Profile
@jmglov
jmglov / bb-bootleg-pod-nixos.md
Created October 26, 2024 11:44
How to make the retrogradeorbit/bootleg Babashka pod work in NixOS

As per Jakub Holý's great Awesome Babashka: Parse & produce HTML and SQLite post, you can use the retrogradeorbit/bootleg pod to get Hickory (HTML to Hiccup parser) in Babashka. However, if you're on NixOS, you're going to get yelled at when you try to start a REPL:

: bb-playground; bb repl                                                                                                                                                                       
Downloading pod retrogradeorbit/bootleg (0.1.9) 
Successfully installed pod retrogradeorbit/bootleg (0.1.9)                                                                                                                                     
Exception in thread "main" java.io.IOException:

task dependencies

Let's say you're writing a project management app. A user will have a bunch of tasks to do and each task might depend on other tasks. Your challenge is to write a function that, given tasks and dependencies, gives at least one order for the tasks such that no task is done before its dependencies are done.

(def tasks [:clean-breakfast :shoes :socks :cook-breakfast :eat-breakfast])

(def dependencies [[:socks :shoes] ;; socks come before shoes; shoes depend on socks
                   [:cook-breakfast :eat-breakfast] ;; cooking comes before eating
 [:eat-breakfast :clean-breakfast]])
@bhb
bhb / blockchain-w-spec.md
Last active July 1, 2022 11:24
Building a blockchain, assisted by Clojure spec

Building a blockchain, assisted by Clojure spec

In an effort to gain at least a superficial understanding of the technical implementation of cryptocurrencies, I recently worked my way through "Learn Blockchains by Building One" using Clojure.

This was a good chance to experiment with using spec in new ways. At work, we primarily use spec to validate our global re-frame state and to validate data at system boundaries. For this project, I experimented with using instrumentation much more pervasively than I had done elsewhere.

This is not a guide to spec (there are already many excellent resources for this). Rather, it's an experience report exploring what went well, what is still missing, and quite a few unanswered questions for future research. If you have solutions for any of the problems I've presented, please let me know!

You don't need to know or care about blockchains to understand the code be

@claus
claus / ipfs-server-setup.md
Last active June 21, 2025 13:28
Host Your Site Under Your Domain on IPFS

Host Your Site Under Your Domain on IPFS

This is a step-by-step tutorial for hosting your website under your domain on IPFS, from zero, on a DigitalOcean Ubuntu 16.04.3 x64 Droplet (i am using the $10 variant with 2GB RAM).

Install IPFS

Log in as root.

First, make sure the system is up to date, and install tar and wget:

@postpostscript
postpostscript / replify
Last active November 7, 2024 02:47
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for `%s`\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
@codemedic
codemedic / konsole-with-palette-colours.css
Last active September 24, 2024 13:25
CSS for KDE Konsole minimal, lighter, dark tabs
QTabBar,
QTabBar::tab
{
font-family: "Noto Sans";
font-size: 11px;
height: 16px;
padding: 2px;
border: 0px;
border-bottom: 3px solid palette(dark);
background-color: palette(dark);