Skip to content

Instantly share code, notes, and snippets.

Avatar

grifferz

View GitHub Profile
@grifferz
grifferz / fix_tags.pl
Created Jan 8, 2020
Given YAML file from gather_tags.pl, stuff tags back into current copy of photos
View fix_tags.pl
#!usr/bin/env perl
# This uses the YAML generated by gather_tags.pl
#
# See: https://gist.github.com/grifferz/5b116b87d93ee9586a053a4021ef86fc
use strict;
use warnings;
use utf8;
@grifferz
grifferz / gather_tags.pl
Created Jan 8, 2020
Get all the "Keywords", "Subject" and "TagsList" tags from my photos and save them out as a YAML file
View gather_tags.pl
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode qw(decode_utf8);
@ARGV = map { decode_utf8($_, 1) } @ARGV;
@grifferz
grifferz / blkleaderboard.sh
Last active Oct 12, 2020
Block device leaderboard
View blkleaderboard.sh
#!/bin/bash
# Paste at shell prompt (or download and execute) and get:
#
# sdc 9936 hours ( 1.13 years) 3.49TiB SAMSUNG MZ7KH3T8
# nvme0n1 9936 hours ( 1.13 years) 3.49TiB SAMSUNG MZQLB3T8HALS-00007
# sde 9932 hours ( 1.13 years) 4.55TiB ST5000LM000-2AN1
# sdd 9931 hours ( 1.13 years) 4.55TiB ST5000LM000-2AN1
# sdb 9617 hours ( 1.09 years) 0.01TiB SuperMicro SSD
# sda 9616 hours ( 1.09 years) 0.01TiB SuperMicro SSD
@grifferz
grifferz / attackers.sh
Created Jun 23, 2019
Dumb script to resolve a list of IPs to their reverse DNS and AS details
View attackers.sh
#!/bin/bash
#
# Dumb script to resolve a list of IPs to their reverse DNS and AS details.
#
# This directly calls whois against whois.cymru.com for each line of input
# so if you're going to run it with hundreds of lines of input, maybe don't
# do that and use their DNS zone instead.
#
# Usage
# Pipe a list of counts and IP addresses through me like:
@grifferz
grifferz / git_svn_bash_prompt.sh
Created Feb 12, 2019
Would generally recommend powerline of bashline or oh-my-zsh or something but this makes a fancy bash prompt from scratch
View git_svn_bash_prompt.sh
#!/bin/bash
# Started off being just the git/svn stuff from authors below but then got
# hacked on by me to add other silly things.
#
# Needs:
# - A 256-colour terminal
# - A terminal that supports colour emoji (else you'll need to substitute boring monochrome unicode glyphs and maybe colour them with terminal escapes)
# - Powerline font ("fonts-powerline" on Debian/Ubuntu) for the separator chevrons
# - Add this to your ~/.bashrc like:
@grifferz
grifferz / 50-set-preferred-lft
Created Nov 17, 2018
networkd-dispatcher bash script to set all IPv6 addresses to preferred_lft 0
View 50-set-preferred-lft
#!/bin/bash
# bash v4 required because of associative array below.
# networkd-dispatcher hook script that sets every IPv6 address on the system to
# have preferred_lft 0. Put it in for example in
# /etc/networkd-dispatcher/routable.d/50-set-preferred-lft and make sure it's
# executable and owned by root:root.
#
# There's an associative array below where you can list addresses NOT to
@grifferz
grifferz / files_of_interest.j2
Last active Jun 7, 2018
Build a config file with a supplied list of file paths, indicating any that are missing
View files_of_interest.j2
{# If there were any files missing on the remote host then remove them from #}
{# the files_of_interest list using the "difference" filter. #}
{% if missing_files_of_interest | length > 0 %}
{% set files_of_interest = files_of_interest | difference(missing_files_of_interest) %}
############################################################################
# The following files were configured but don't exist on this host right now:
{% for file in missing_files_of_interest %}
# {{ file }}
{% endfor %}
############################################################################
View fio-results-mirror-btrfs.txt
seqread-128k: (g=0): rw=read, bs=128K-128K/128K-128K/128K-128K, ioengine=libaio, iodepth=1
seqwrite-128k: (g=1): rw=write, bs=128K-128K/128K-128K/128K-128K, ioengine=libaio, iodepth=1
randread-4k: (g=2): rw=randread, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=16
randwrite-4k: (g=3): rw=randwrite, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=16
fio-2.13
Starting 4 processes
seqread-128k: Laying out IO file(s) (1 file(s) / 1024MB)
seqwrite-128k: Laying out IO file(s) (1 file(s) / 1024MB)
randread-4k: Laying out IO file(s) (1 file(s) / 1024MB)
randwrite-4k: Laying out IO file(s) (1 file(s) / 1024MB)
View fio-results-md-2-disk-ext4.txt
seqread-128k: Laying out IO file(s) (1 file(s) / 1024MB)
seqwrite-128k: Laying out IO file(s) (1 file(s) / 1024MB)
randread-4k: Laying out IO file(s) (1 file(s) / 1024MB)
randwrite-4k: Laying out IO file(s) (1 file(s) / 1024MB)
Jobs: 1 (f=1): [_(3),F(1)] [100.0% done] [0KB/824KB/0KB /s] [0/206/0 iops] [eta 00m:00s]
seqread-128k: (groupid=0, jobs=1): err= 0: pid=15173: Tue Sep 13 06:45:26 2016
read : io=40511MB, bw=138278KB/s, iops=1080, runt=300001msec
slat (usec): min=45, max=702, avg=105.45, stdev=12.48
clat (usec): min=519, max=23086, avg=804.00, stdev=294.11
lat (usec): min=725, max=23174, avg=911.08, stdev=293.97
View fio-results-single-disk-btrfs.txt
seqread-128k: (g=0): rw=read, bs=128K-128K/128K-128K/128K-128K, ioengine=libaio, iodepth=1
seqwrite-128k: (g=1): rw=write, bs=128K-128K/128K-128K/128K-128K, ioengine=libaio, iodepth=1
randread-4k: (g=2): rw=randread, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=16
randwrite-4k: (g=3): rw=randwrite, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=16
fio-2.13
Starting 4 processes
seqread-128k: Laying out IO file(s) (1 file(s) / 1024MB)
seqwrite-128k: Laying out IO file(s) (1 file(s) / 1024MB)
randread-4k: Laying out IO file(s) (1 file(s) / 1024MB)
randwrite-4k: Laying out IO file(s) (1 file(s) / 1024MB)
You can’t perform that action at this time.