Skip to content

Instantly share code, notes, and snippets.

View Tythos's full-sized avatar
🐧
Coding

Brian Kirkpatrick Tythos

🐧
Coding
View GitHub Profile
@Tythos
Tythos / handlebars.esm.js
Created October 15, 2022 21:20
ES6 module compatibe Handlebars variation
var Handlebars =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
@Tythos
Tythos / Dockerfile.cordovabox
Created June 23, 2021 23:50
Dockerfile for cordova build environment supporting static file web applications
# define base image and system tools
FROM fedora
RUN yum install unzip zip findutils which wget less -y
# install java
RUN yum install java-1.8.0-openjdk-devel -y
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
# get gradle, android sdk
RUN curl -s "https://get.sdkman.io" | bash &&\
@Tythos
Tythos / cassandra.yaml
Created May 21, 2021 00:15
cassandra.yaml (minimal cassandra configuration, useful for docker)
cluster_name: 'Test Cluster'
partitioner: org.apache.cassandra.dht.Murmur3Partitioner
commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "172.17.0.2"
listen_address: 172.17.0.2
endpoint_snitch: SimpleSnitch
@Tythos
Tythos / WsgiApp.py
Created May 20, 2021 05:55
WsgiApp.py
"""This is a convenient wrapping/mapping pattern for Flask-based WSGI
applications. Specifically, a WSGI app may require state (for database
connections, for example) that is poorly-managed by function-based WSGI
routes. Instead, this pattern lets a specific class instance define it's
server state, with methods being defined and decorated for the usual Flask
route syntax. The URL map is then dynamically constructed from the pattern
property that the decorator attaches to route methods, with support for
optional route arguments (like method=[]) as well.
"""
@Tythos
Tythos / WasmThread-v1.0.0.js
Last active January 15, 2022 13:01
WasmThread-v1.0.0.js
/**
* @file
*
* Single-file JavaScript module that defines a developer-friendly interface
* for adapting, and calling, WASM modules in a threaded manner using
* WebWorkers. There are two components merged within this single file:
*
* 1. The first "if" block is evaluated by the WebWorker (child thread). This
* block is responsible for instantating the WASM module referenced by the
* main thread, and then managing the individual calls. This includes
/**
* Copyright (c) 2013 Gildas Lormeau. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
@Tythos
Tythos / Logger.h
Created October 16, 2020 20:13
Logger.h : Easy and simple header-only logging singleton modeled after syslog severity levels
/* Logging singleton modeled after syslog severity levels. Currently, no
differentiation (aside from the message prefix) is made between severity
levels, beyond filtering against the current logger state, except that any
message at or above "ERROR" will also throw a runtime error.
*/
#include <iostream>
#include <stdexcept>
#include <string>
@Tythos
Tythos / 0.1.0.js
Last active August 12, 2021 18:23
spheregeo
/**
*/
define(function(require, exports, module) {
let D2R = Math.PI / 180;
let sum = function(series) { return series.reduce(function(a=0, b) { return a + b; } ) };
/**
* Returns a unit vector (3-element Array) for the given phi and theta
* values.
@Tythos
Tythos / WebThread-v1.0.0.js
Created June 15, 2020 23:11
WebThread-v1.0.0.js
/* Single-file JavaScript module that defines a developer-friendly interface
for adapting, and using, AMD-compatible modules in a threaded manner using
WebWorkers. There are two components:
1. The first ("if") block is evaluated by the WebWorker, which should
include the following line at the beginning of the file:
> importScripts("WebThread.js");
The module in question, which should be single-file (dependency-free),
@Tythos
Tythos / kirksrv.py
Last active May 21, 2020 18:12
Basic reusable server base, using Flask-based WSGI application served asynchronously w/ gevent.pywsgi
"""Basic reusable server base, using Flask-based WSGI application served
asynchronously with gevent.pywsgi; provides a nice template / starting point
that I've reused several dozen times.
"""
import os
import flask
from gevent import pywsgi
MOD_PATH, _ = os.path.split(os.path.abspath(__file__))