Skip to content

Instantly share code, notes, and snippets.

@jojomi
jojomi / filename-fixer.go
Created June 25, 2022 19:34
Golang Filename fixer
package main
import (
"fmt"
"os"
"path/filepath"
"regexp"
)
type RenamePlan struct {
@jojomi
jojomi / elektronische-datenkopie.sh
Created April 26, 2022 04:19
Schufa-Datenkopie in durchsuchbares PDF umwandeln
#!/bin/sh
set -ex
NAME=schufaselbstauskunft
convert *.jpg "${NAME}.pdf"
alias docker_ocrmypdf='docker run --rm -i jbarlow83/ocrmypdf'
docker_ocrmypdf - - <"${NAME}.pdf" >"${NAME}-scan.pdf"
@jojomi
jojomi / .bash_aliases_docker
Last active September 19, 2017 07:45
Much shorter aliases for docker-compose and helper commands (cleanup)
# include in ~/.bashrc (Linux) or ~/.profile (MacOS X) using "source ~/.bash_aliases_docker" (remember to source ~/.bashrc after that for instant accessability)
alias c='docker-compose'
alias cb='docker-compose build'
alias cu='docker-compose up'
alias cud='docker-compose up -d'
alias cre='docker-compose restart'
alias creh='docker-compose stop && docker-compose up'
@jojomi
jojomi / gather.go
Last active February 11, 2021 18:54
JSON-Datei mit deutschen KFZ-Kennzeichen erstellen (aus Wikipedia)
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
@jojomi
jojomi / convert-wav-to-opus.sh
Created January 21, 2016 20:54
Convert a directory of wav files to opus
#!/usr/bin/env bash
shopt -s globstar
for file in ./**/*.wav
do
echo "$file"
outfile="${file%.wav}.opus"
echo "$outfile"
if [ -f "$outfile" ]
then
@jojomi
jojomi / five.md
Created September 24, 2015 06:59
The Five Year Pledge

Software Needs Love

I promise to design my software so that

  • if nobody would touch anything, it would still run after five years.

This pledge requires to take care of restarting failed services automatically. If there is some kind of daemon process, it may not leak any memory because memory would eventually exhaust.

  • if someone needs to port the system after five years, it would not be impossible.
@jojomi
jojomi / chroot.sh
Last active September 8, 2016 04:51
Chrooting into an encrypted disk
#!/usr/bin/env bash
set -e
DISK_ENCRYPTED=/dev/sda2
DISK_BOOT=/dev/sda1
VG_NAME=cryptVG
echo 'chrooting'
lsblk
@jojomi
jojomi / build.sh
Last active December 25, 2018 12:53
Simple bash script for cross-compiling Go code for release
#!/usr/bin/env sh
#
# For using UPX on linux, goupx (https://github.com/pwaller/goupx) needs to be
# available in $PATH.
# install goupx:
# GOPATH=${HOME}/.local go get github.com/pwaller/goupx
# sudo ln -s "${HOME}/.local/bin/goupx" "/usr/local/bin/"
#
# self reference: https://gist.github.com/jojomi/0eed777db2617e9fb0af#file-build-sh