Skip to content

Instantly share code, notes, and snippets.

Filip H.F. "FiXato" Slagter FiXato

Block or report user

Report or block FiXato

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 Mar 26, 2019
Save bash history into separate files based on iTerm2 session id.
View .profile_term_session_history
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"
HISTFILE="${HISTFILE_DIRECTORY}/bash_history-${TERM_SESSION_ID//:/-}"
@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 6, 2019
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
@FiXato
FiXato / bash_prompt_with_git_and_rbenv.sh
Last active Aug 29, 2015 — forked from kyanny/gist:1668822
Updated original bash prompt with git and rbenv example with a check for the __git_ps1 function instead of existence of a git bash-completion file.
View bash_prompt_with_git_and_rbenv.sh
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source ~/.rbenv/completions/rbenv.bash
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
@FiXato
FiXato / router_statistics.rb
Created Sep 20, 2013
Simple Ruby script to retrieve some useful Internet connexion statistics from a Siemens Gigaset sx762 modem/router. By default it only returns the Up- and Down-stream statistics, External IP & MAC addresses and Uptime, but if you pass the --verbose argument, you get the raw data back as well.
View router_statistics.rb
#!/usr/bin/env ruby
# router_statistics.rb: Simple Ruby script to retrieve some useful Internet connexion statistics from a Siemens Gigaset sx762 modem/router
# (c) 2013, Filip H.F. "FiXato" Slagter <fixato+router_statistics@gmail.com>
# By default it only returns the Up- and Down-stream statistics, External IP & MAC addresses and Uptime, but if you pass the --verbose argument, you get the raw data back as well.
#
# Sample output (with faked IP/MAC addresses):
# Siemens Gigaset sx762 Statistics:
# ================================================================================
# Up: 833 / 825 kbps [Attn: 408 dB / Noise: 56 dB / Pwr: 122 dBm]
# Down: 1309 / 1316 kpbs [Attn: 602 dB / Noise: 61 dB / Pwr: 149 dBm]
@FiXato
FiXato / rename_images_to_their_iptc_captions.rb
Last active Dec 22, 2015
Renames images to their IPTC captions, suffixing them with the original filename as well. Example: 1-bar.jpg => bar-to-the-awesome - 1-bar.jpg Very hacky, but it scratched my itch and might help someone else too. :)
View rename_images_to_their_iptc_captions.rb
# encoding: utf-8
# Renames images to their IPTC captions, suffixing them with the original filename as well.
# Example:
# 1-bar.jpg => bar-to-the-awesome - 1-bar.jpg
# Very hacky, but it scratched my itch and might help someone else too. :)
require 'fileutils'
require 'iptc'
FileUtils.cd("path/to/source/images")
output_dir = "renamed"
FileUtils.mkdir(output_dir) unless File.exist?(output_dir)
You can’t perform that action at this time.