Skip to content

Instantly share code, notes, and snippets.

View mcnewton's full-sized avatar

Matthew Newton mcnewton

View GitHub Profile
@mcnewton
mcnewton / scribus2epub.pl
Created March 18, 2018 21:03
Extract Scribus document text and output HTML for converting to ePub
#! /usr/bin/perl
#
# Go some way to extracting text from a Scribus document and
# converting it to simple HTML that can be used for an ePub file.
#
# Copyright (c) 2018 Matthew Newton
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation

Keybase proof

I hereby claim:

  • I am mcnewton on github.
  • I am mcn (https://keybase.io/mcn) on keybase.
  • I have a public key whose fingerprint is 9C71 6EFE D061 4931 2502 C875 6D9C E5AB 042E 00C9

To claim this, I am signing this object:

@mcnewton
mcnewton / libwbclient-ctx.patch
Created March 27, 2016 21:57
Debian Samba packages - patches for libwbclient ctx functions backported from 4.2.1
From d112c753cb88a370e8e9ad7d65a11b6f2bca4bce Mon Sep 17 00:00:00 2001
From: Matthew Newton <mcn4@leicester.ac.uk>
Date: Thu, 8 Jan 2015 15:11:15 +0000
Subject: [PATCH 1/9] Make sure response->extra_data.data is always cleared out
Otherwise a bad read can sometimes cause the function to return -1 with
an invalid pointer in extra_data.data, which is attempted to be freed
by the caller (e.g. libwbclient/wbc_pam.c wbcAuthenticateUserEx())
by calling winbindd_free_response().
@mcnewton
mcnewton / freeradiuscheck.sh
Last active April 27, 2020 14:50
Check that FreeRADIUS stack is running
#! /bin/bash
CONFIG_DISK_THRESHOLD=95
FR_PIDFILE=/var/run/freeradius/freeradius.pid
FR_BINARY=/usr/sbin/freeradius
DATE_MIN=$(date +%_M)
TEST_USER=checkuser
TEST_DOMAIN=my.domain.example
TEST_PASSWORD=password
@mcnewton
mcnewton / libwbclient-thread-safe.patch
Created January 23, 2015 00:07
Patch against Samba v3-6-stable to make libwbclient thread-safe
From 96c6263840943cc84ba78d9d5ae95e7fa08daa5c Mon Sep 17 00:00:00 2001
From: Matthew Newton <mcn4@leicester.ac.uk>
Date: Thu, 22 Jan 2015 23:47:08 +0000
Subject: [PATCH] libwbclient thread safe for samba 3.6
This version is good enough for FreeRADIUS auth, but won't clean up if
the library is dlclose()'d and will leak memory in that case, so not
suitable for merging.
---
nsswitch/wb_common.c | 153 ++++++++++++++++++++++++++++++++++++---------
@mcnewton
mcnewton / example.out
Last active November 14, 2023 19:25
hex dump C buffer
example with linelen=16, split=8
30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 01234567 89ABCDEF
61 62 63 64 65 66 30 31 32 33 34 35 36 37 38 39 abcdef01 23456789
41 41 41 41 42 42 42 42 43 43 43 43 44 44 44 44 AAAABBBB CCCCDDDD
48 65 6c 6c 6f 20 57 6f 72 6c 64 0d 54 65 73 74 Hello Wo rld.Test
2d 6c 69 6e 65 0a -line.
example with linelen=16, split=4
30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 0123 4567 89AB CDEF
61 62 63 64 65 66 30 31 32 33 34 35 36 37 38 39 abcd ef01 2345 6789
input {
file {
path => "/path/to/exim/mainlog"
start_position => 'beginning'
sincedb_path => "/dev/null"
}
# udp {
# port => 5000
# type => syslog
# }
EXIM_MSGID [0-9A-Za-z]{6}-[0-9A-Za-z]{6}-[0-9A-Za-z]{2}
EXIM_FLAGS (<=|[-=>*]>|[*]{2}|==)
EXIM_DATE %{YEAR:exim_year}-%{MONTHNUM:exim_month}-%{MONTHDAY:exim_day} %{TIME:exim_time}
EXIM_PID \[%{POSINT}\]
EXIM_QT ((\d+y)?(\d+w)?(\d+d)?(\d+h)?(\d+m)?(\d+s)?)
EXIM_EXCLUDE_TERMS (Message is frozen|(Start|End) queue run| Warning: | retry time not reached | no (IP address|host name) found for (IP address|host) | unexpected disconnection while reading SMTP command | no immediate delivery: |another process is handling this message)
EXIM_REMOTE_HOST (H=(%{NOTSPACE:remote_hostname} )?(\(%{NOTSPACE:remote_heloname}\) )?\[%{IP:remote_host}\](:%{NUMBER:remote_port})?)
EXIM_INTERFACE (I=\[%{IP:exim_interface}\](:%{NUMBER:exim_interface_port})?)
EXIM_PROTOCOL (P=%{NOTSPACE:protocol})
EXIM_MSG_SIZE (S=%{NUMBER:exim_msg_size})