Skip to content

Instantly share code, notes, and snippets.

@strikeout
strikeout / BitMEX Jazz BEEP
Last active July 30, 2020 19:06
Aural indication of XBTUSD price movements via BitMEX websocket realtime-trade data. Uses the blues scale to add some funk to your trading. Copy & paste into your browser's console..
/**
* BitMEX JAZZ BEEP
*
* Aural indication of XBTUSD price movements via BitMEX websocket realtime-trade data.
* Uses the blues scale to add some funk to your trading.
*
*/
var options = {
@strikeout
strikeout / Hasura Keycloak.md
Created June 20, 2020 11:04 — forked from webdeb/Hasura Keycloak.md
Basic Keycloak Script Mapper to provide Hasura claims

Steps to provide Hasura Claims in Keycloak generated JWT

  1. Create your realm / client
  2. Inside client configuration go to "Mappers"
  3. Click on "Create"
  4. Name it "hasura"
  5. Choose Mapper Type "Script Mapper"
  6. Add following script to demonstrate how it works
@strikeout
strikeout / README.md
Created August 10, 2019 14:50 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.
@strikeout
strikeout / dmp.php
Created May 27, 2016 14:14
dmp.php
<?
/**
* Debug helper function. This is a wrapper for var_dump() that adds
* the <pre /> tags, cleans up newlines and indents, and runs
* htmlentities() before output.
*
* @param mixed $var The variable to dump.
* @param string $label OPTIONAL Label to prepend to output.
* @param bool $echo OPTIONAL Echo output if true.
* @return string
@strikeout
strikeout / header.js
Created November 13, 2013 11:28
Attach Meteor HTTP Headers
/**
* HTTP Header Security
*
* enforce HTTP Strict Transport Security (HSTS) to prevent ManInTheMiddle-attacks
* on supported browsers (all, but IE)
* > http://www.html5rocks.com/en/tutorials/security/transport-layer-security
*
* @header Strict-Transport-Security: max-age=2592000; includeSubDomains
*/
@strikeout
strikeout / market.js
Created June 28, 2016 22:14 — forked from maxant/market.js
Files for creating a trading engine with Node.js.
// /////////////////////////////////////////////////
// this file contains all the classes related to a
// market.
// /////////////////////////////////////////////////
var log4js = require('log4js');
var logger = log4js.getLogger(require('path').basename(__filename, '.js'));
require('es6-collections');
var _ = require('underscore');
/**
@strikeout
strikeout / cluster_observeChanges.js
Created January 9, 2014 16:50
please help me with my flawed logic on how to observeChanges in a clustered multi-server environment (with oplog-scaling).
// 200k entries and more
HugeCollection = new Meteor.Collection("HugeCollection");
// convenience collection to hold the computed stats of HugeCollection
StatsForHugeCollection = new Meteor.Collection("StatsForHugeCollection");
/**
* Observer
*/
@strikeout
strikeout / gist:5979392
Created July 11, 2013 21:24
WORKING server.js for openshift deployment of meteor app
////////// Requires //////////
var Fiber = require("fibers");
var fs = require("fs");
var http = require("http");
var path = require("path");
var url = require("url");
// connect (and some other NPM modules) use $NODE_ENV to make some decisions;
@strikeout
strikeout / addHostToMongoReplicaset.sh
Created October 8, 2015 10:20
Adds own host to a mongo replica-set. Runs on server-startup
#!/usr/bin/env bash
#get own hostname
ME=$(hostname);
# find replica-set master, we think its the first in the array
MASTER=`mongo --quiet --eval "cfg=rs.config(); print( cfg.members[0].host );"`
# connect to master, add ME
mongo --host $MASTER --eval "print( rs.add('"$ME"') );"
@strikeout
strikeout / sites-enabled__app.conf
Last active August 29, 2015 14:23
Nginx vhost config for Meteor with working websockets
server {
server_name thomassteinhauer.com;
location / {
root /var/www/app/bundle/;
}
location /admin {
root /var/www/admin/bundle/;
}