Skip to content

Instantly share code, notes, and snippets.

View FiXato's full-sized avatar

Filip H.F. "FiXato" Slagter FiXato

View GitHub Profile
@FiXato
FiXato / download_studio_ghibli_promo_pics.sh
Last active January 6, 2021 13:31
Shell script to download freely released Studio Ghibli images
#!/usr/bin/env bash
#encoding: utf-8
#Shell script to download freely released Studio Ghibli images (http://www.ghibli.jp/info/013344/)
film_names=( "marnie" "kaguyahime" "kazetachinu" "kokurikozaka" "karigurashi" "ponyo" "ged" "chihiro")
for film_name in "${film_names[@]}"; do
mkdir -p "./${film_name}" && curl "http://www.ghibli.jp/images/${film_name}.jpg" -o "./${film_name}/${film_name}.jpg" && curl "http://www.ghibli.jp/gallery/${film_name}[001-050].jpg" -H "Referer: http://www.ghibli.jp/works/${film_name}/#frame" -o "./${film_name}/${film_name}-#1.jpg"
done
@FiXato
FiXato / LICENSE
Last active September 25, 2020 13:56
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.
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 February 25, 2020 21:22
A script to help automate recording of reverse replays.
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 January 10, 2020 16:18
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.
#!/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 September 17, 2019 16:43
Set your Android device's wallpaper through Termux, based on today's Geograph Britain & Ireland image
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 January 21, 2021 17:44
Save bash history into separate files based on iTerm2 session id.
#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 February 17, 2019 21:27
CLI tool for archiving the Google+ Comments frame for Blogger blogs
#!/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 February 28, 2020 05:01
Get an overview of likely byte-for-byte duplicates in a zip file, using 7z, gawk and grep, based on CRC+filesize
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 16:24
MoonBlaster (MSX Audio File Format) metadata extractor & renamer
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 August 29, 2015 13:59 — forked from henrik/en.yml
# config/locales/en.yml
en:
i18n:
language:
name: 'English'