Skip to content

Instantly share code, notes, and snippets.

View trapd00r's full-sized avatar
🐫
japh

magnus woldrich trapd00r

🐫
japh
View GitHub Profile
## The device used to store the share data a.k.a. userdata.
## INTERNAL -> Use the same drive Batocera has been flashed to. See https://wiki.batocera.org/add_games_bios on how to add files to the internal storage.
## ANYEXTERNAL -> Use the first external storage detected. See https://wiki.batocera.org/store_games_on_a_second_usb_sata_drive
## Putting the name here of the drive instead will use that specific external storage. Use the menu in Batocera to see the available options.
## DEVICES -> Use external storage for individual folders. See https://wiki.batocera.org/store_games_on_a_second_usb_sata_drive#manual_configuration_with_batocera-bootconf_advanced
## DEV -> Manually define the GUID of the storage device requested. See https://wiki.batocera.org/store_games_on_a_second_usb_sata_drive#dev_mode
## NETWORK -> Use the network share, requires configuration first. See https://wiki.batocera.org/store_games_on_a_nas
sharedevice=NETWORK
{- a function that calculates the length of a rope -}
length :: Rope -> Int
length (Leaf s) = length s
length (Node l r) = length l + length r
{- a function that calculates the height of a rope -}
height :: Rope -> Int
height (Leaf s) = 1
height (Node l r) = 1 + max (height l) (height r)
# local dev machine, Archlinux, all good
$ perl -MTime::Local=timelocal_posix -E ''
$ perl -v
This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-linux-thread-multi
# Debian 11, server
$ perl -MTime::Local=timelocal_posix -E ''
@trapd00r
trapd00r / foo.vim
Created May 1, 2022 14:31
trying to conditionally load different versions of same plugins
for myplugin in ['yankmatches.vim', 'currentline.vim', 'cccp.vim', 'LS_COLORS.vim']
let path = expand("%:~")
" developing, use dev version of plugin
if path =~ '\vdev[/]' . myplugin
echo 'match!'
let project_dir = fnamemodify(path, ":h:h")
Plug project_dir
" use stable version
" display a visual aid when lining long things up
" disable colorcolumn entirely if
" - cursor is in the first column
" - cursor is in the same column that &colorcolumn is set to
function! ColorColumnAtCursorPositionToggle()
let column = col('.')
if exists(&colorcolumn) || column == 1 || column == &colorcolumn
set colorcolumn&
else
let &colorcolumn = column
@trapd00r
trapd00r / beets-comments.sh
Created June 16, 2021 12:11
beet comment/comments
[130]-(3481)-~
% mpc search comments knarkmacka
"comments" is not a valid search type: <any|Artist|Album|AlbumArtist|Title|Track|Name|Genre|Date|Composer|Performer|Comment|Disc|MUSICBRAINZ_ARTISTID|MUSICBRAINZ_ALBUMID|MUSICBRAINZ_ALBUMARTISTID|MUSICBRAINZ_TRACKID|MUSICBRAINZ_RELEASETRACKID|OriginalDate|ArtistSort|AlbumArtistSort|AlbumSort|Label|MUSICBRAINZ_WORKID|Grouping|Work|Conductor>
MPD error: already in command list mode
[1]-(3482)-~
% mpc search comment knarkmacka
(3483)-~
% while read d; do tree --noreport $d; done <<(beet ls comments:KNARKMACKA|dirnamep|sort -u)
/mnt/music8/+TAGGED/I/Idde Schultz/Idde Schultz β”‚1995β”‚ Idde Schultz [CD, FLAC]
β”œβ”€β”€ 01 I Min Famn.flac
@trapd00r
trapd00r / amigaremix.sh
Created May 31, 2021 17:31
amigaremixdumper_naive
wget $(for x in $(curl -s https://amigaremix.com/remixes/{1..35} | grep -o '/listen/.+[.]mp3'|perl -pe 's|^|http://amigaremix.com|'|perl -pe 's/ /%20/g'); do echo $x; done)
@trapd00r
trapd00r / foo.pl
Created May 31, 2021 08:20
delete $file with a suffix if $file with other suffix exists
#!/usr/bin/perl
# vim: ft=perl:fdm=marker:fmr=#<,#>:fen:et:sw=2:
# abstract: delete $file with a suffix if $file with other suffix exists
use strict;
use warnings FATAL => 'all';
use vars qw($VERSION);
use autodie qw(:all);
use utf8;
use open qw(:std :utf8);
@trapd00r
trapd00r / beets-singletons.yaml
Created May 29, 2021 17:50
beet import singletons as-is
# beet import -sAW --set artist="$ARTIST" *(.) "$@"
# artist tag is always specified
paths:
singleton: %upper{%left{$artist,1}}/$artist/+tracks/$base_name
item_fields:
base_name: |
import os.path
base = os.path.basename(path)
return os.path.splitext(base)[0]
[alias]
last = "!git log -10 HEAD --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[m \\033[32m%s\\033[m %-.40s \\033[30;1m%s\\033[m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }';"
lastt = "!git log -76 HEAD --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[m \\033[32m%s\\033[m %-.40s \\033[30;1m%s\\033[m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }';"