Skip to content

Instantly share code, notes, and snippets.

View cjsmeele's full-sized avatar
🐪
​🦋🐧

Chris Smeele cjsmeele

🐪
​🦋🐧
View GitHub Profile
@cjsmeele
cjsmeele / parser-combinators.py
Last active September 7, 2020 21:41
Parser combinators in Python3 (bad)
# Parser combinators in Python3 - Chris Smeele, 2020.
#
# This code works. Just not very good, due to it mapping very badly to
# Python's execution model (it blows up with recursion depth).
# It's also incredibly ugly, since Python very much does not want you to write
# code in this style.
# Creating it was a nice exercise however.
#
# I hereby release this awful code into the public domain.
# Please leave it there and don't try to actually use it :-)
class Fail(Exception): pass
# run as e.g.: test("/tempZone/home/rods/xyz");
def test(a, c, r):
import genquery
# First arg: name of an empty or non-existent collection where we can
# create subcollections for testing.
# Test queries will be on COLL_PARENT_NAME = test_coll
test_coll = a[0]
{
"with_completed_query": {
"old": {
"avg": 0.7472595930099487,
"max": 0.768233060836792,
"min": 0.7419149875640869,
"msi_stats": {
"msiExecGenQuery": 10,
"msiGetContInxFromGenQueryOut": 10,
"msiGetMoreRows": 740,
import time
import genquery
import oldquery
from collections import OrderedDict
# Call as `irule run_test null ruleExecOut`
#
# genquery.py should be genquery from the fork: https://github.com/cjsmeele/irods_rule_engine_plugin_python/blob/genquery-extensions/genquery.py
# oldquery.py should be the current genquery: https://github.com/irods/irods_rule_engine_plugin_python/blob/master/genquery.py
# Include in core.py, and run as: `irule test null null`
# Results end up in rodsLog.
#
# My results with 9052 collections and 10 tests for each genquery version:
#
# original row_iterator: avg: 739ms, max: 821ms, min: 715ms
# extended row_iterator: avg: 376ms, max: 388ms, min: 367ms
import time
@cjsmeele
cjsmeele / sok
Created October 24, 2019 16:02
Small socat wrapper for my two most common usecases
#!/usr/bin/env perl
use 5.12.0;
use warnings;
=head1 SYNOPSIS
sok [-PORT [SOCAT_FLAGS...]]
sok HOST [PORT [SOCAT_FLAGS...]]
@cjsmeele
cjsmeele / test-stmt-table-exhaustion.py
Created August 6, 2019 14:21
Test iRODS python client library query auto-closing
from __future__ import print_function
from irods.session import iRODSSession
from irods.models import Collection, DataObject
from irods.exception import MultipleResultsFound
def make_session():
return iRODSSession(
host = 'localhost',
port = 1247,
user = 'rods',
@cjsmeele
cjsmeele / nederc.hh
Created October 23, 2018 15:09
Dit maakt C++ toegankelijker voor senioren ;-)
/**
* \file
* \brief NederC voor Cenioren
* \version 1
*/
#ifndef _NEDERC_HH
#define _NEDERC_HH
#define aligneer_als alignas
#define alignering_van alignof
@cjsmeele
cjsmeele / gbops.cc
Last active August 8, 2018 01:25
Game Boy CPU instruction listing with concise (partial) emulator implementation
// Ops {{{
// Copyright (c) 2018, Chris Smeele.
// All rights reserved.
// Rights to the actual ISA may belong to the respective right holders.
// Clock / flag attributes sourced from this table:
// http://pastraiser.com/cpu/gameboy/gameboy_opcodes.html
//
// - e2 and f2 have been changed to size '1' from '2' (this appears to be an error in the table).

Keybase proof

I hereby claim:

  • I am cjsmeele on github.
  • I am cjsmeele (https://keybase.io/cjsmeele) on keybase.
  • I have a public key whose fingerprint is DC1B FE5F 18C6 5BAE 8C00 A426 C358 6AFC 417E F6A5

To claim this, I am signing this object: