Skip to content

Instantly share code, notes, and snippets.

johnlane / tom.rb
Last active Aug 29, 2015
The One Module (TOM) is an example Ruby module that demonstrates setting of module, class, class instance and instance variables for classes that include or extend the module.
View tom.rb
# TOM : The One Module
# An example Ruby module that demonstrates setting of module, class, class instance
# and instance variables for classes that include or extend the module
# (c) John Lane 20140218
module Tom
extend self # makes module methods available as class and instance methods.
johnlane / eicar.eml
Created Sep 10, 2014
EICAR test message
View eicar.eml
From: John Doe <>
Subject: EICAR Test Message
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="XXXXboundary text"
This is a multipart message in MIME format.
--XXXXboundary text
Content-Type: text/plain
johnlane / cryptsetup-keyfile.patch
Created Dec 9, 2014
initrd support for crypt key file with offset and size
View cryptsetup-keyfile.patch
--- encrypt_hook 2014-12-09 12:47:02.379911026 +0000
+++ encrypt_hook 2014-12-09 12:47:41.416087076 +0000
@@ -7,7 +7,7 @@
# Get keyfile if specified
if [ -n "$cryptkey" ]; then
- IFS=: read ckdev ckarg1 ckarg2 <<EOF
+ IFS=: read ckdev ckarg1 ckarg2 ckarg3 ckarg4 <<EOF
View gpg_transition_395DDE80_22D05A45.asc
Hash: SHA1
PGP Transition Statement
I have transitioned my GPG key from an old 1024-bit DSA key to a new 4096-bit RSA key.
The old key is now invalid; please use my new key from now on.
johnlane / gist:7fece74c501fd77cc0c3
Created Apr 17, 2015
Grub loopback iso example
View gist:7fece74c501fd77cc0c3
set imgdevpath='/dev/disk/by-uuid/e7bc3210-ee80-4111-a6da-3db1d2e2cbef'
set isofile="/iso/tails-i386-1.2.2.iso"
loopback loop $isofile
linux (loop)/live/vmlinuz fromiso=$imgdevpath/$isofile boot=live config noswap nopersistent nomodeset noautologin splash
initrd (loop)/live/initrd.img
johnlane / PKGBUILD
Created May 5, 2015
PKGBUILD for AUR package netkit-bsd-finger with systemd support
# Maintainer:
# Contributor: dorphell <>
# Updated for systemd by John Lane <archlinux at jelmail dot com>
pkgdesc="BSD-finger ported to Linux"
arch=('i686' 'x86_64')
johnlane / PKGBUILD
Created Jun 11, 2015
revised PKGBUILD for Ghost 0.6.4 with npm dependency
# Maintainer: Chun Yang <>
pkgdesc="Free, open, simple blogging platform"
arch=('i686' 'x86_64')
depends=('nodejs>=0.12' 'npm')
View Example Grub

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

johnlane / cell.rb
Created Oct 1, 2015
Widget wrapper around cell
View cell.rb
# app/concepts/widget/cell.rb
# A very basic "Widget" that is a container of Cell objects
# When rendered, it recursively renders all cells that it
# contains.
class Widget < Cell::Concept
attr_reader :parent
attr_reader :children
# Create a new widget
johnlane /
Created Apr 16, 2016
Can a Trailblazer concept inherit from another and be able to extend its operati ons (multiple inheritance) ?

The effect of multiple inheritance can be achieved by using modules.

First define the ActiveRecord objects like this:

class Topic < ActiveRecord::Base; end
class Location < ActiveRecord::Base; end

There is no longer a base Tag abstract class, allowing Tag to be defined as a module like this (app/concepts/tag/crud.rb):

module Tag
You can’t perform that action at this time.