Skip to content

Instantly share code, notes, and snippets.

@johnlane
johnlane / session.md
Created October 7, 2015 09:40
Trailblazer Session

The Session

The application can behave differently based on the request URL by presenting a diferent 'site' experience to the end-user, who may also choose from the locales (language presentations) that the site supports.The Session manages this: it's a PORO plus some Trailblazer operations. It keeps state for the current request including current user, the Rails session and site and locale selections. It's established with a Session::Create operation before processing a request.

The Session does not persist across requests, except for data placed in its persistent store, for which the Rails session is used (but another Hash-like object could be used instead).

The Session is established in the ApplicationController:

  before_action do
    Session::Create.reject(params.merge(store: session, host: request.host,           
 preferred_locales: get_preferred_locales_from_http_request)) do |op|
@johnlane
johnlane / gpgtest.sh
Created January 18, 2017 14:38
Testing GNUPG trust-signatures
#!/bin/sh
#
export GNUPGHOME
echo -----------------------------------------------------------------
echo VERSION INFORMATION
gpg --version
uname -vimposr
@johnlane
johnlane / gpgtest.out
Created January 18, 2017 14:44
GNUPG trust-signatures test output
-----------------------------------------------------------------
VERSION INFORMATION
gpg (GnuPG) 2.1.17
libgcrypt 1.7.5
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /home/john/.gnupg

Keybase proof

I hereby claim:

  • I am johnlane on github.
  • I am johnlane (https://keybase.io/johnlane) on keybase.
  • I have a public key ASDE5-a54ZM6flDHH8atfeVPVgu1sXGE16_2aNJ4OPnG-go

To claim this, I am signing this object:

@johnlane
johnlane / PGP KEY 22D05A45
Created January 23, 2017 11:20
44E44ABB2410742A8476BC9B955B200A22D05A45
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- -----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFTZ1L0BEACU0k8PmTWLXWAbDy1Nr89bv3xjm3QkaNtxdKHvHW/n1ScJwWfm
INfDesKoNKRniatTcHiKxDGQEFtALTSzbFC8nf/Gvtq1sgfn3Io9I12/McanZpKK
Xml9my8Yov+b98F4EkYCf/QykHU/Ec4U0InMtFbbsBlMyLbU2nty9efc9IQre0cV
EuMgG6xCc7aQyAI2SX54wIbnHhjOyqKUoAC3Ela3boSBUIn60Gz7EsvbIJk4O4UR
5ncpuqnF1Almse3wVfe9biBJK6RMUrcs8Aw/8r9B0mDA6REVqLEBoyI/QJDL8rEn
#!/usr/bin/env python
import gi
gi.require_version('Gtk','3.0')
gi.require_version('Keybinder', '3.0')
from gi.repository import Gtk, Gdk, Keybinder
class MenuBar(Gtk.Window):
def __init__(self, *args):
@johnlane
johnlane / log
Created September 2, 2017 16:15
ROM VER: 1.1.4
CFG 06
NAND
NAND Read OK
U-Boot SPL 2014.01-openwrt4-g9abc897-dirty (Jun 27 2015 - 18:14:58)
SPL: applying tuned DDR SDRAM settings
MEM: DDR Echo DLL delay: 22/23
MEM: DDR Write DQS delay: 65/67
MEM: DDR Read DQS delay: 1f/1f
U-Boot 1.1.4-g12193fce-dirty (Dec 14 2009 - 13:39:19)
WN604 (ar7240) U-boot dni7 V0.8
DRAM:
sri
#### TAP VALUE 1 = a, 2 = b
32 MB
Top of RAM usable for U-Boot at: 82000000
Reserving 278k for U-Boot at: 81fb8000
@johnlane
johnlane / PKGBUILD (rssh)
Last active September 12, 2017 20:11
ArchLinux AUR PKGBUILD for rsync-compatible 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')
@johnlane
johnlane / in_out_trailblazer.md
Created October 19, 2015 18:10
The Ins and Outs of a Trailblazer Operation Contract

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