Skip to content

Instantly share code, notes, and snippets.

Avatar

Filip H.F. "FiXato" Slagter FiXato

View GitHub Profile
@FiXato
FiXato / LICENSE
Last active Sep 25, 2020
A proof-of-concept script based on a conversation over on #Mastodon at mastodon.social/@FiXato/104738706980490091, It tries to provide a CLI solution to copying the music referenced in an M3U8 playlist to a separate directory so it can be more easily synced to another device such as an Android phone, while retaining the playlist order.
View LICENSE
MIT License
Copyright (c) 2020 Filip H.F. "FiXato" Slagter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@FiXato
FiXato / openMSX_lets_play.tcl
Created Feb 25, 2020
A script to help automate recording of reverse replays.
View openMSX_lets_play.tcl
namespace eval lets_play {
set debug_log 1
proc log {args} {
variable debug_log
if {$debug_log != 1} { return }
puts "DEBUG: $args"
}
proc position_to_time {position} {
if {[string is double $position] == 1} {
@FiXato
FiXato / toot_media_viewer_cygwin_irfanview.sh
Last active Jan 10, 2020
Wrapper scripts to open each passed URL as an image in various environments (such as Termux on Android, and IrfanView on Cygwin for Windows), meant to be used with the `toot` CLI Mastodon client.
View toot_media_viewer_cygwin_irfanview.sh
#!/usr/bin/env bash
PATH_TO_IRFANVIEW="${HOME}/iview454_setup/i_view32.exe"
tmpfilelist="$(mktemp "${TMP}/toot_media_viewer.XXXXXX.filelist.txt")"
tmpfilelist_win="$(mktemp "${TMP}/toot_media_viewer.XXXXXX.win.filelist.txt")"
# Loop through all arguments passed to the script, assuming they are all URLs
for url in "$@"
do
basename="$(basename "$url")"
# Get the extension from the URL's basename. Default to 'png' if basename has no period
@FiXato
FiXato / termux-wallpaper-from-geograph.sh
Created Sep 17, 2019
Set your Android device's wallpaper through Termux, based on today's Geograph Britain & Ireland image
View termux-wallpaper-from-geograph.sh
curl --silent "https://m.geograph.org.uk" | termux-wallpaper -u "https://geograph.org.uk$(curl --silent "https://www.geograph.org.uk/more.php?id=$(grep -oP 'daily.php.+/photo/\K([0-9]{1,})')" | grep original | grep -oP '(/reuse.php[^"]{1,})')"
@FiXato
FiXato / .profile_term_session_history
Last active Jan 21, 2021
Save bash history into separate files based on iTerm2 session id.
View .profile_term_session_history
#TODO: support WSL's $WT_SESSION and tmux panes ($TMUX_PANE?)
if [ "$TERM_SESSION_ID" != "" ]; then
if [ "$HISTFILE" != "" ]; then
OLD_HISTFILE="$HISTFILE"
else
OLD_HISTFILE="~/.bash_history"
fi
HISTFILE_DIRECTORY="${HOME}/.histories/bash_histories"
mkdir -p "$HISTFILE_DIRECTORY"
@FiXato
FiXato / _functions.sh
Last active Feb 17, 2019
CLI tool for archiving the Google+ Comments frame for Blogger blogs
View _functions.sh
#!/usr/bin/env bash
# encoding: utf-8
#FIXME: move this to an variables.env file
REQUEST_THROTTLE="${REQUEST_THROTTLE:-0}"
function debug() {
if [ "$DEBUG" == "1" -o "$DEBUG" == "true" -o "$DEBUG" == "TRUE" ]; then
echo -e "$@" 1>&2
fi
@FiXato
FiXato / 7z-list-duplicates.awk
Last active Feb 28, 2020
Get an overview of likely byte-for-byte duplicates in a zip file, using 7z, gawk and grep, based on CRC+filesize
View 7z-list-duplicates.awk
function process_group(name, body) {
size = gensub(/.+\nSize = ([0-9]+)\n.+/, "\\1", "G", body);
crc = gensub(/.+\nCRC = ([A-F0-9]{8})\n.+/, "\\1", "G", body);
packed = gensub(/.+\nPacked Size = ([0-9]+)\n.+/, "\\1", "G", body);
modified = gensub(/.+\nModified = ([A-F0-9]{8})\n.+/, "\\1", "G", body);
id = crc "-" size;
uniques[id]++;
data[id]["size"] = size;
@FiXato
FiXato / LICENSE
Last active May 12, 2018
MoonBlaster (MSX Audio File Format) metadata extractor & renamer
View LICENSE
MIT License
Copyright © 2018, Filip H.F. "FiXato" Slagter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@FiXato
FiXato / en.yml
Last active Aug 29, 2015 — forked from henrik/en.yml
View en.yml
# config/locales/en.yml
en:
i18n:
language:
name: 'English'
View mage.rb
class Mage < Player
def initialize(*args)
super(*args)
@str, @int, @dex = 1, 6, 2
end
def level_up
@str += 1
@int += 6
@dex += 2