Skip to content

Instantly share code, notes, and snippets.

Oliver Jones OllieJones

Block or report user

Report or block OllieJones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
OllieJones / queue.js
Created Feb 9, 2019
Queue class, super simple, based on Kate Morley's queue code.
View queue.js
'use strict';
A class to represent a queue
Created by Kate Morley - - and released under the terms
of the CC0 1.0 Universal legal code:
View embl-browser.js
'use strict';
/*globals ebml */
if ( !window.ebml ) window.ebml = {};
ebml.EbmlDecoder = function EbmlDecoder( options ) {
var schema = {
"80": {
OllieJones / streamPeek.js
Last active Sep 5, 2018
Read useful information from a MP4 data stream
View streamPeek.js
* this code examines a MP4 data stream.
* it looks at the appropriate atoms to determine width, height, and frame rate.
* It is a sleazy approach, the equivalent of grepping for necessary
* boxes rather than using box lengths to parse the file.
function read32( buff, fourcc, offset ) {
let start = 0;
OllieJones / validateGithubWebhook.js
Created Oct 5, 2017
Github webhooks use a shared secret for validation. The webhook itself contains a header X-Hub-Signature containing a hash of the webhook body. This function checks that hash against the body.
View validateGithubWebhook.js
'use strict';
const crypto = require( 'crypto' );
function validateGithub( secret, signature, rawBody ) {
if( (!signature) || signature.length === 0 ) return false;
if( (!rawBody) || rawBody.length === 0 ) return false;
try {
const splits = signature.split( '=' );
OllieJones / nonce.js
Created Oct 3, 2017
Snippets of Javascript.
View nonce.js
'use strict';
/* node.js nonce: crypto-quality random session key (filename safe base64, rfc4648) */
const btoa = require( 'btoa' );
const crypto = require( 'crypto' );
function nonce( length ) {
const rndLen = 1+(( (length)+(length<<1) +3)>>2);
const randomArray = crypto.randomBytes( rndLen );
OllieJones /
Last active Jul 20, 2016
Detecting a disconnected RDP session in a unix / linux / bsd server.

Here is a way to obtain a list of disconnected xrdp sessions. It relies on the fact that the xrdp server is, in normal X session manager usage, the only client that establishes a TCP connection to the Xvnc X Window System display server. (The other client programs -- the ones doing things for the user -- use UNIX-domain sockets for their display connections).

When an xrdp session is active, the associated Xvnc display server has two TCP connections, one in the ESTABLISHED state, and the other in the LISTEN state. That looks something like this using the lsof(1) program.

$ sudo lsof  -b -w -n -c /^Xvnc$/b -a -iTCP:5900-5999 
Xvnc    1625 guest    1u  IPv4 252910      0t0  TCP (LISTEN)
Xvnc    1625 guest    9u  IPv4 261226      0t0  TCP> (ESTABLISHED)

If the user of the remote session abandons it by closing the RDP connection (or, in the case of an Apache Guacamole RDP session

OllieJones / DataTableResultSet.cs
Last active Sep 20, 2019
C# code for handling Ajax calls for the client table-rendering plugin.
View DataTableResultSet.cs
/// <summary>
/// Resultset to be JSON stringified and set back to client.
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class DataTableResultSet
/// <summary>Array of records. Each element of the array is itself an array of columns</summary>
public List<List<string>> data = new List<List<string>>();
View ActivateSigAlgoritms.cs
OllieJones / AddSignatureAlgs.cs
Created Mar 4, 2016
Add this code to your dotnet app to enable rsa-sha256, rsa-384, and rsa-512 signatures.
View AddSignatureAlgs.cs
/// <summary>Declare the signature type for rsa-sha512</summary>
public class RsaPkCs1Sha512SignatureDescription : SignatureDescription
public RsaPkCs1Sha512SignatureDescription()
KeyAlgorithm = typeof(RSACryptoServiceProvider).FullName;
DigestAlgorithm = typeof(SHA512CryptoServiceProvider).FullName;
FormatterAlgorithm = typeof(RSAPKCS1SignatureFormatter).FullName;
DeformatterAlgorithm = typeof(RSAPKCS1SignatureDeformatter).FullName;
OllieJones / RandomString.sql
Last active Feb 25, 2016
Cryptographic quality random text string generation in SQL Server
View RandomString.sql
-- =============================================
-- Description: Generate a 20-character cryptographically secure random string of uppercase letters and digits.
--- The entropy of such a string is about 100 bits: plenty.
-- Reference:
-- =============================================
You can’t perform that action at this time.