Skip to content

Instantly share code, notes, and snippets.

View berkus's full-sized avatar
🎯
Practice your desensitization exercises to remain unfazed by enemy atrocities

Berkus Decker berkus

🎯
Practice your desensitization exercises to remain unfazed by enemy atrocities
View GitHub Profile
@berkus
berkus / lyrics.txt
Created October 20, 2025 21:49
Jonne Valtonen's (Purple Motion) Mosaic Days lyrics
Sun, may you shine down on us
let us rejoice in your warmth
in delight,
in delight
Come, sit by me on the ground
we'll chase away the demons
fly, over the hills,
of memories
@berkus
berkus / HOWTO.md
Created October 20, 2025 21:47
How to extract data from the Yojimbo3 database:
  1. rg -a "text match", note the database file to use
  2. sqlite3 Database.db
  3. .tables
  4. .schema <table>
  5. select... until you find the ZBLOB's table primary key Z_PK
  6. Save it to file with SELECT writefile('out.plist', ZBYTES) FROM ZBLOB WHERE Z_PK=298; <-- use your pk
  7. Convert plist to text format with plutil -convert xml1 out.plist
  8. Open it with an editor and find your contents among shitloads of metadata
@berkus
berkus / main.rs
Created October 20, 2025 08:55
Rust undroppable
// From https://jack.wrenn.fyi/blog/undroppable/
use std::mem;
/// A type that cannot be dropped.
pub struct Undroppable<T: ?Sized>(mem::ManuallyDrop<T>);
impl<T> Undroppable<T> {
// Makes `val` undroppable.
//
@berkus
berkus / anyfile.groovy
Created May 8, 2024 18:00
Groovy/Gradle print object properties
def filtered = ['class', 'active']
println theObject.properties
.sort{it.key}
.collect{it}
.findAll{!filtered.contains(it.key)}
.join('\n')
@berkus
berkus / convemoji.md
Last active October 2, 2025 03:14
Conventional Commits with Emoji
@berkus
berkus / pijularize.sh
Created January 21, 2022 08:18
Pijularize a Git repository with all branches
#!/bin/sh
set -e
set -x
reponame=`basename $(pwd)`
echo "#######################################################################################"
echo "# Script to import all local branches from current repository (${reponame}) into pijul"
echo "# Will create a bunch of temp repos for import, so have sufficient disk space"
echo "#######################################################################################"
@berkus
berkus / AnalogLiterals.hpp
Created September 13, 2021 21:34 — forked from yamamushi/AnalogLiterals.hpp
Multi-Dimensional Analog Literals in C++
/*
Referenced from:
http://web.archive.org/web/20120110153227/http://weegen.home.xs4all.nl/eelis/analogliterals.xhtml
*/
#ifndef ANALOGLITERALS_HPP
#define ANALOGLITERALS_HPP
namespace analog_literals {
@berkus
berkus / playground.rs
Created August 29, 2019 07:34 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#![feature(unboxed_closures, fn_traits)]
fn main() {
let add = |a: i32, b: i32| a + b;
let sqr = |a: i32| a.pow(2);
let add_two = |a: i32| a + 2;
assert_eq!(chain(add, sqr)(2, 3), 25);
assert_eq!(
chain(
@berkus
berkus / playground.rs
Created August 2, 2019 15:24 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::collections::hash_map::Entry;
use std::collections::HashMap;
trait EntryExt<'a, K, V>: 'a {
fn or_insert_with2<F: FnOnce(&K) -> V>(self, f: F) -> &'a mut V;
}
impl<'a, K, V> EntryExt<'a, K, V> for Entry<'a, K, V> {
fn or_insert_with2<F: FnOnce(&K) -> V>(self, f: F) -> &'a mut V {
match self {
# See https://news.ycombinator.com/item?id=20213092
FROM python:3
ARG VERSION=2.1.1.0
RUN pip install pytz passlib bcrypt radicale==$VERSION
ENV RADICALE_CONFIG /etc/radicale/config
RUN mkdir -p /etc/radicale
COPY config $RADICALE_CONFIG