Skip to content

Instantly share code, notes, and snippets.

{
"version": 1,
"formatters": {
"simple": {
"format": "%(levelname)s:%(name)s:%(message)s"
}
},
"handlers": {
"stderr": {
"class": "logging.StreamHandler",
@Wolf480pl
Wolf480pl / example.sh
Last active April 18, 2018 14:39
An example of why bind mounts are not considered separate filesystems by open_by_handle_at, and probably by NFS server
#!/bin/sh
# assumes running as root
mkdir /tmp/wolfhome2
mount --bind /home/wolf480 /tmp/wolfhome2
./handlejack /home/ otheruser/.bashrc /tmp/wolfhome2/
# should print mountid and fd, then wait for keypress
# then spit out the otheruser's bashrc
@Wolf480pl
Wolf480pl / with-prefix
Created September 26, 2017 17:39
A script to execute something with a specified prefix added to PATH, LD_LIBRARY_PATH, etc. I've heard it's useful on CentOS.
#!/bin/sh
# Copyright 2017 Wolf480pl <wolf480@interia.pl
#
# 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:
@Wolf480pl
Wolf480pl / dkim-verify.pl
Created April 29, 2017 13:07
A DKIM verifier for OpenSMTPD's filter-perl
use strict;
use warnings;
use Mail::DKIM 0.17;
use Mail::DKIM::Verifier;
use Mail::DKIM::DkPolicy;
my $hostname = "prometheus";
my $reject_error = 0;
my $reject_fail = 1;
if [ "$1" == "-r" ]; then
exec curl -L "$2".txt
else
exec gist "$@"
fi
#!/usr/bin/env python3
import sys
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GObject
gobject = GObject
DBusGMainLoop(set_as_default=True)
sessionBus = dbus.SessionBus()
@Wolf480pl
Wolf480pl / aallserv.py
Last active October 29, 2016 17:07
Hexchat Addons
__module_name__ = "AAllServ"
__module_version__ = "0.1"
__module_description__ = "Execute a command for REALLY ALL servers"
import hexchat
def aallserv_cb(word, word_eol, userdata):
for chan in hexchat.get_list('channels'):
if chan.type == 1:
@Wolf480pl
Wolf480pl / cython.lang
Created March 12, 2016 13:34
cython language highlighting for gtksourceview2
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Andreas Gaeb <a.gaeb@web.de>
Copyright (C) 2014 Andreas Gaeb <a.gaeb@web.de>
GtkSourceView is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
@Wolf480pl
Wolf480pl / README.md
Last active February 21, 2018 18:27
Tools for parsing and pretty-printing slack json logs

slack2dsv.sh

  • converts slack .json log to tab-separated DSV format
  • requires [jq] and awk
  • takes slack .json log as first argument
  • reads users.json from parent directory (adjustable by USERFILE env var)
  • if a user in the USERFILE has a dispname attribute, it is used instead of name (useful in conjunction with slack-colorize-nicks.sh)

chat-prettify.sh

  • reads chat log in tab-separated DSV format from stdin (eg. from slack2dsv.sh), formats the timestamps and aligns the nicknames
  • requires awk
@Wolf480pl
Wolf480pl / bars.conky
Last active August 29, 2015 14:18
Lua+Cairo widgets (the widgets.lua file) resembling Rainmeter's meters, and example Conky scripts using these widgets.
#!/usr/bin/conky -c
# Copyright (c) 2013 Wolf480pl (wolf480@interia.pl)
#
# 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: