Skip to content

Instantly share code, notes, and snippets.

Avatar

Olaf Lessenich xai

View GitHub Profile
View enumerate_workdays.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 Olaf Lessenich <xai@linux.com>
#
# Distributed under terms of the MIT license.
from datetime import timedelta, datetime
import argparse
@xai
xai / reversewords.awk
Created Mar 3, 2020
reverse words in second column
View reversewords.awk
{
OFS=FS
n=split($2, words, " ")
$2=""
for(i=n;i>=1;i--) $2=$2 words[i] " "
gsub(/ +$/, "", $2)
print
}
View keybase.md

Keybase proof

I hereby claim:

  • I am xai on github.
  • I am xaitax (https://keybase.io/xaitax) on keybase.
  • I have a public key ASATxk26Xp4Br3HtDcOnF60lR6oZw8qNKhjM4hk_l8FDAQo

To claim this, I am signing this object:

@xai
xai / find-by-hash.sh
Last active Mar 13, 2019 — forked from mloberg/gist:3750653
Find file in git based on md5 checksum.
View find-by-hash.sh
#!/bin/sh
usage() {
echo "Usage: $0 [-m] [-s] hash file"
echo "\t-m use md5 for hashing"
echo "\t-s use sha1 for hashing (this is the default)"
exit 1
}
HASHCMD="sha1sum"
View killfile.sieve
require "vacation";
if anyof (address "From" "bunghole@company.org")
{
vacation :days 1 :addresses ["me@company.org"]
"This mail will not be read by me, it has been expunged to /dev/null instead.
Apparently, I put your mail address into my killfile.
You sent me an unusual amount of annoying, unsolicited, and undesirable mail in the past.
This is not an error, I register each killfile entry manually and very carefully.
@xai
xai / base.c
Created Feb 26, 2018
Merge example
View base.c
int f(int x) {
return x;
}
@xai
xai / diff.py
Last active Mar 20, 2017
Identify changes using libgit2 combined with google's diff approach
View diff.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Olaf Lessenich <xai@linux.com>
#
# Distributed under terms of the MIT license.
import sys
from pygit2 import Repository
@xai
xai / anonymize.py
Created Mar 13, 2017
Anonymize logfiles
View anonymize.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Olaf Lessenich <xai@linux.com>
#
# Distributed under terms of the MIT license.
"""
Anonymize logfiles