Skip to content

Instantly share code, notes, and snippets.

View arleighdickerson's full-sized avatar
🇺🇲
🏴󠁵󠁳󠁷󠁶󠁿 Courage in the hollers

Arleigh Dickerson arleighdickerson

🇺🇲
🏴󠁵󠁳󠁷󠁶󠁿 Courage in the hollers
View GitHub Profile
@arleighdickerson
arleighdickerson / MsgpackSerializer.php
Last active January 12, 2018 13:13
Msgpack serialization support for voryx/thruway wamp2 implementation
<?php
namespace Thruway\Serializer;
use MessagePack; // composer dep rybakit/msgpack": "^0.2.2",
use Thruway\Message\Message;
use Thruway\Message\MessageException;
class MsgpackSerializer implements SerializerInterface {
/**
@arleighdickerson
arleighdickerson / watch.js
Created December 24, 2017 17:25
hot reloading of server-side feathersjs application (put this in src/)
const logger = require('winston');
const invalidate = require('invalidate-module');
const { resolve } = require('path');
const chokidar = require('chokidar');
process.on('unhandledRejection', (reason, p) => {
logger.error('Unhandled Rejection at: Promise ', p, reason);
});
const src = (...args) => resolve(__dirname, ...args);
-server
-ea
-Xms4096m
-Xmx8192m
-XX:+UseStringDeduplication
-XX:+AggressiveOpts
-XX:+UseG1GC
-XX:MaxGCPauseMillis=100
-XX:G1HeapRegionSize=2
-XX:ParallelGCThreads=8
<?php
namespace console\stream;
use phpseclib\Crypt\Base;
use React\Stream\ThroughStream;
class CipherTransform extends ThroughStream {
const OP_ENCRYPT = 'encrypt';
const OP_DECRYPT = 'decrypt';
@arleighdickerson
arleighdickerson / init.lua
Last active November 28, 2016 17:10
init.lua for hammerspoon... tap caps lock for escape, hold for ctrl, shift and caps lock tap sends shift escape
-- adapted from https://gist.github.com/arbelt/b91e1f38a0880afb316dd5b5732759f1
-- if shift key is held during a caps lock tap, send shift-escape
ctrl_table = {
send_escape = true,
last_mods = {}
}
control_key_timer = hs.timer.delayed.new(0.15, function()
ctrl_table["send_escape"] = false
-- log.i("timer fired")
@arleighdickerson
arleighdickerson / ThemeAutoloader.php
Created August 11, 2016 04:04
Autoload theme-specific controllers
<?php
namespace frontend\components;
use Yii;
/**
* Class ThemeAutoloader
*
* @package frontend\components
<?php
namespace common\components;
use Aws\S3\S3Client;
use yii\caching\Cache;
use yii\helpers\ArrayHelper;
class S3Cache extends Cache {
echo 8589934590 > /proc/sys/kernel/shmmax
echo 4096 > /proc/sys/vm/nr_hugepages
exit 0
@arleighdickerson
arleighdickerson / ClientUrls.php
Last active March 26, 2016 14:04
Utility to make working with yii routes easier on the client side
<?php
namespace common\helpers;
use yii\base\InvalidParamException;
use yii\helpers\Json;
use yii\helpers\Url;
class ClientUrls {
<?php
namespace console\controllers;
use yii\helpers\StringHelper;
use yii\console\Controller;
use Yii;
abstract class SimulationController extends Controller {
public $defaultAction = 'default';