Skip to content

Instantly share code, notes, and snippets.

@Juul
Juul / mount_dd_Image.sh
Created May 18, 2019 05:49
Mount all partitions from a full drive image
#!/bin/bash
# Mount all partitions from a full drive image
# in subdirs inside the specified dir
set -e
if [ ! "$#" -eq "2" ]; then
echo "Usage: $(basename $0) <image.dd> <mount_dir>" >&2
exit 1
@Juul
Juul / leveldump.js
Last active July 2, 2019 21:48
Simple tool to dump the contents of leveldb databases
#!/usr/bin/env node
var fs = require('fs');
try {
var level = require('level');
} catch(e) {
console.error("You must have the node module `level` installed.");
console.error("To install run: `npm install level`");
process.exit(1);
@Juul
Juul / book_scanning_guide.md
Created July 13, 2019 22:07
Guide on book scanning using camera-based scanner like the one at noisebridge

Today I went to noisebridge and scanned Wonders Through the Microscope and it is now available for download on the freestore! I will likely also generate a color version of the PDF but the book is in black and white so it really doesn't add much.

This is my first attempt at book scanning and post-processing using only open source tools so I thought I'd share this book scanning guide based on my experiences :)

Scan

I used the noisebridge book scanner hardware and their python script which remote-controls two DSLR cameras and downloads the photos over USB. It worked very well.

Note that in addition to gphoto2 you will also need jpegtran. This command will get you both:

Keybase proof

I hereby claim:

  • I am juul on github.
  • I am juul (https://keybase.io/juul) on keybase.
  • I have a public key ASDq1RuKZVTrMsQYIO8uYJkuCDg-_IytPr_8dxThs71y-Ao

To claim this, I am signing this object:

@Juul
Juul / memusage.sh
Created January 20, 2020 05:17
Show total combined memory usage (virtual, resident and dirty) for processes matching the given grep arguments
#!/bin/bash
# Show total memory usage of all processes matching the supplied grep arguments
if [ "$#" -lt "1" ]; then
echo "Usage: $0 <grep arguments>" >&2
exit 1
fi
function humanize() {
@Juul
Juul / doom_readme.md
Last active March 20, 2020 21:06
doom 1

Check which version of chocolate-doom your distro has:

apt-cache show chocolate-doom|grep "Version:"

If it's version 3.0.0 or above then install it:

sudo apt install chocolate-doom
@Juul
Juul / ash-timeout-prompt.ash
Created May 5, 2016 13:37
An ash shell script (busybox) for a user prompt with timeout
#!/bin/ash
# This script waits for three seconds for the user to press any key
# that generates a character (other than enter) and otherwise
# proceeds normally
#
# This is an ash shell script for use in e.g. a busybox initrd
# to allow letting the user boot into a rescue environment (e.g. the initrd itself)
#
# This script requires: dd, stty, grep, cut, kill and sleep
@Juul
Juul / gpg_public.key
Created May 25, 2020 11:53
My GPG public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBF7LOWQBDACv1M8bZUiiEFKJ0ITmVyKH3U1ixKnJ2HV2KzPlSMnlV8doyfYx
ydv0Udu7WSeAfIpk9nMrwlzIqRSJx0sOsO0ZpiVdo+loKehBjoQiCiBzwmt0UOHL
/knFEwBC1Sh33D+GfjUG+8cVZgEwx0ySt/w8boGS86384AQtwZ8CS2AGgIMZO7ld
XPIIUr2uHPvZzT8We4+VhqBRwHKmIwDnPkJBs1LtLuRbgmPu3yJBSe38J6J6X4au
53bNKdE7kQmqzraawFJjVb14/fU6UoqBMkwOiTQ/1N/0JVUr+DOUTSI74RwnGPr8
6qbQYbEY5SRDCsOAy9FhoEjf75nCTNQ+GQNa5Vih9tpVrEqikPRN+eouTD5YfnJv
QcxJI8RORHsTCSGNGC8OmX+GM5NPS0jRwixeoGWEJBLIKjEP9HpIOLWYR3RNWTGe
IwtJdWxXPYo8uDR4GAnTaTRbu5NTyQe65hORl7gZsrtALjojXmCZTyWlmuYRGHn/
@Juul
Juul / raspian_bluetooth_sink.md
Last active September 20, 2020 17:03
Set up raspberry pi 3 as bluetooth sink (raspbian buster)

If you want to use pulseaudio, see BaReinhard's repo.

If you want to use bluealsa and avoid pulseaudio, keep reading.

So far this solution has two problems I haven't solved:

  • A ~450 ms delay (which can be compensated for in pavucontrol on the client)
  • If more than one source connects at the same time bluealsa-aplay crashes and bluealsa also needs restarting

If you have pulseaudio installed, make sure /etc/pulse/default.pa has the following two lines commented out and restart pulseaudio:

@Juul
Juul / certbot_reverse_proxy_guide.md
Created May 29, 2019 01:04
How to use Let's Encrypt / certbot with a reverse proxy

apache config

The secret sauce is:

<Location /.well-known>
    ProxyPass !
</Location>