Skip to content

Instantly share code, notes, and snippets.

@hrkokw
hrkokw / update
Created December 17, 2022 02:42
Git update hook example (poorly tested)
#!/bin/sh
refname="$1"
oldrev="$2"
newrev="$3"
function test_exif {
local commit="$1" path="$2"
echo "${path}" | egrep -iq '\.(jpe?g|png)$' || return 0
@hrkokw
hrkokw / z_skipplugins
Last active September 18, 2021 01:22
Blosxom z_skipplugins plugin
# -*- mode: perl -*-
# vim: syntax=perl
#
# https://88171.net/blosxom-skipplugins-plugin
package z_skipplugins;
use strict;
use warnings;
my %skip = (
@hrkokw
hrkokw / cacheentries
Created September 4, 2021 00:40
Blosxom cacheentries plugin
# -*- mode: perl -*-
# vim: syntax=perl
#
# https://88171.net/blosxom-cacheentries-plugin
package cacheentries;
use Storable qw(lock_store lock_retrieve);
use File::stat;
use strict;
@hrkokw
hrkokw / more
Last active September 4, 2021 00:35
Blosxom more plugin
# -*- mode: perl -*-
# vim: syntax=perl
#
# https://88171.net/blosxom-more-plugin
package more;
use strict;
use warnings;
our $truncated = 0;
#!/usr/bin/perl
use strict;
use warnings;
# Based on git-set-file-times in Git SCM Wiki
# https://git.wiki.kernel.org/index.php/ExampleScripts
#
# Sets mtime and atime of files to the latest author time in git.
#
# This is useful after the first clone of the rsync repository BEFORE you
#!/bin/bash
target="$1"
if [ ! -f "$target" ]; then
echo >&2 "Usage: $0 file"
exit 1
fi
suffix=`basename "$target" | sed 's/^.*\.//'`
temp=`mktemp --tmpdir=. temp-XXXXXXXXXX.$suffix`
#!/bin/bash
junkdir=${1:-~/Maildir/.Junk}
find $junkdir/cur -type f -name '*:2*' | while read file; do
while :; do
bogofilter < $file
case $? in
1|2) # 1 for non-spam; 2 for unsure
echo >&2 "learning as spam: `basename $file`"
@hrkokw
hrkokw / FreeNAS-9.2.1.5, RAID-Z1, randrw, 500MB
Created May 31, 2014 16:44
NAS benchmark (over AFP, FreeNAS on HP MicroServer N54L 4GB RAM)
fio: this platform does not support process shared mutexes, forcing use of threads. Use the 'thread' option to get rid of this warning.
RandomRW: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=sync, iodepth=1
fio-2.0.15
Starting 1 process
RandomRW: Laying out IO file(s) (1 file(s) / 500MB)
RandomRW: (groupid=0, jobs=1): err= 0: pid=4355: Sun May 25 13:41:57 2014
read : io=256348KB, bw=44785KB/s, iops=11196 , runt= 5724msec
clat (usec): min=1 , max=37 , avg= 2.42, stdev= 1.17
lat (usec): min=1 , max=37 , avg= 2.52, stdev= 1.25