Skip to content

Instantly share code, notes, and snippets.

View jchristgit's full-sized avatar
🐍
#OpenErlang

jchristgit

🐍
#OpenErlang
View GitHub Profile
@jchristgit
jchristgit / photocopy.sh
Created July 14, 2023 21:42
Copy DateTimeOriginal from EXIF metadata to file modification times and log output appropriately
#!/bin/bash
set -euo pipefail
ARCHIVE="/your/gigantic/mess/of/pictures"
MEDIA="/path/to/your/cleaned-up/pictures/"
pushd $ARCHIVE >/dev/null
@jchristgit
jchristgit / README.txt
Last active June 28, 2023 22:04
Download all attachments from a Discord data export via Python, awk & wget
The above can be used to download all your attachments out of a Discord data export.
Attachments are downloaded one by one, and placed alongside the channels they were sent in.
The attachment filename is the message ID and the attachment filename, joined by an underscore.
It is safe to re-run the download script should it have been aborted,
though if aborted in the middle of a download that file may only be partial.
The script makes no attempt to re-download files that are already downloaded.
@jchristgit
jchristgit / qlc_bench.exs
Created May 21, 2023 19:22
Benchmarking of Erlang's QLC module in various ways
tab = :ets.new(:test, [:set, :public])
:ets.insert(tab, Enum.map(1..10_000, &{&1, %{id: &1, name: "#{&1}"}}))
qh = :ets.table(tab)
ms = [{{:"$1", :"$2"}, [], [{{:"$1", :"$1", :"$2"}}]}]
qhtraverse = :ets.table(tab, traverse: {:select, ms})
# Elixir queries
qh0 = :qlc.string_to_handle('[{Id, Id, Value} || {Id, Value} <- Handle, Id =:= RequestedId].', [], Handle: qh, RequestedId: 500_000)
qh1a = :qlc.string_to_handle('[{Id, Id, Value} || {Id, Value} <- Handle].', [], Handle: qh, RequestedId: 500_000)

Keybase proof

I hereby claim:

  • I am jchristgit on github.
  • I am johanneschrist (https://keybase.io/johanneschrist) on keybase.
  • I have a public key whose fingerprint is 8C05 D0E9 8B79 14ED EBDC C8CC 8E8E 0928 2F2E 17AF

To claim this, I am signing this object:

@jchristgit
jchristgit / .vimrc
Created February 14, 2018 22:17
personal vimrc for use with neovim
" Plugin Installation through Vim-Plug
" https://github.com/junegunn/vim-plug
call plug#begin('~/.vim/plugged')
" - Editing Helpers -
" surround.vim
" quoting / paranthesizing made simple
" https://github.com/tpope/vim-surround
Plug 'tpope/vim-surround'
@jchristgit
jchristgit / create_labels.sh
Created February 22, 2017 20:40 — forked from omegahm/create_labels.sh
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform