Skip to content

Instantly share code, notes, and snippets.

View Injecting Terminal Input.md

Injecting Terminal Input

Some examples demonstrating how to inject keystrokes into a terminal's input stream.

View Example Grub Module.md

This is an example Grub module that demonstrates how to add a command to Grub that can process command-line options and other parameters.

View gitweb-markdown.patch
--- gitweb.cgi.orig 2020-10-06 10:13:45.621810025 +0100
+++ gitweb.cgi 2020-10-06 10:08:21.651823286 +0100
@@ -18,9 +18,10 @@
use Encode;
use Fcntl ':mode';
use File::Find qw();
-use File::Basename qw(basename);
+use File::Basename qw(basename dirname);
use Time::HiRes qw(gettimeofday tv_interval);
use Digest::MD5 qw(md5_hex);
@johnlane
johnlane / wysiwyg.js
Last active Sep 14, 2020
An integrated Markdown WYSIWYG editor
View wysiwyg.js
$(document).on('ready page:load ajaxComplete', function() {
$('textarea.wysiwyg').each(function() {
var textarea = $(this)
textarea.hide().uniqueId();
var textarea_id = textarea[0].id;
var textarea_class = textarea[0].className;
var wysiwyg_id = "wysiwyg_" + textarea_id;
var wysiwyg_class = textarea_class + " wysiwyg";
@johnlane
johnlane / dockbar-gtk2.py
Last active Jul 12, 2020
Example GTK to create a dock-like bar and strut
View dockbar-gtk2.py
#!/usr/bin/env python2
#
# dockbar.py
#
# Example program places a coloured bar across the top of the
# current monitor
#
# demonstrates
#
# (a) creating the bar as an undecorated "dock" window
@johnlane
johnlane / zk3d
Last active Jun 4, 2020
A wrapper for k3d for use with ZFS file systems
View zk3d
#!/bin/bash
# wrapper for k3d v3 usage on ZFS using Docker volumes
# JL20200603
# Usage: pass 'create' as the first argument to create a cluster
# pass 'destroy' (or anything else) to destroy a cluster
#
# The following optional arguments may be provided (in this order):
# second argument is the cluster name (k3d is prefixed to this)
# following arguments apply to create: masters workers
@johnlane
johnlane / arch-zfsroot-install
Created Jun 19, 2018
Simple installer for ArchLinux on ZFS (tested in VirtualBox)
View arch-zfsroot-install
#!/bin/sh
# prerequisites
# pacman -S arch-install-scripts sgdisk rsync
ZPOOL=rootfs
RAIDZ=mirror
DISKS=( /dev/disk/by-id/ata-VBOX_HARDDISK_VB{5f2d4170-647f16b7,f38966d8-57bff7df} )
# Ensure zpool offline
@johnlane
johnlane / dbtest.php
Created Oct 1, 2014
PHP SQLite test script
View dbtest.php
<?php //origin: http://www.if-not-true-then-false.com/2012/php-pdo-sqlite3-example/
// Kludges
const SQLITE3_TEXT = PDO::PARAM_STR;
const SQLITE3_INTEGER = PDO::PARAM_INT;
// Set default timezone
date_default_timezone_set('UTC');
try {
@johnlane
johnlane / in_out_trailblazer.md
Created Oct 19, 2015
The Ins and Outs of a Trailblazer Operation Contract
View in_out_trailblazer.md

The Ins and Outs of a Trailblazer Operation Contract

These notes record my attempts to understand how and when to populate a Trailblazer contract. They may be incomplete, inaccurate or just plain wrong. They may also be right; I hope they are! Comments are welcome.

It all began with the requirement to seed a presenting contract from the inbound request. Having looked for answers in the Trailblazer book and on Gitter (there was a similar conversation on the 25th September), taking

@johnlane
johnlane / PKGBUILD (rssh)
Last active Sep 12, 2017
ArchLinux AUR PKGBUILD for rsync-compatible rssh
View PKGBUILD (rssh)
# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Judd Vinet <jvinet@zeroflux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
pkgname=rssh
pkgver=2.3.4
pkgrel=4
pkgdesc='Restricted secure shell allowing only scp, sftp, cvs, rsync or rdist'
url='http://www.pizzashack.org/rssh/'
license=('custom:rssh')
You can’t perform that action at this time.