Skip to content

Instantly share code, notes, and snippets.

View davalapar's full-sized avatar
🦁
rawr

@davalapar davalapar

🦁
rawr
View GitHub Profile
@davalapar
davalapar / readme.md
Created December 12, 2019 07:43 — forked from jdrew1303/readme.md
Market Order Matching Engine

Introduction

The computer driven markets for instruments like stocks and exchange traded stock options, have transformed finance and the flow of capital. These markets are enabled by order matching engines (and the infrastructure that supports this software). Before computer trading networks and matching engines, stocks where traded on cavernous exchange floors and transaction costs where high. When electronic trading fully matured, floor traders were a fading anachronism and transaction costs had been reduced to pennies a share in many cases. Electronic trading could not exist without advanced network infrastructure, but without the software matching engines no shares would change hands. The computer trading networks, the matching engine software has also created a concentrated nexus of potential failure. Failures in these systems have increased as the frequency and volume on the electronic networks has increased. The position of order matching engines in the trading infrastructure makes these systems o

'use strict';
const puppeteer = require('puppeteer');
(async () => {
/* PRECONDITION:
0. download ublock, I used https://github.com/gorhill/uBlock/releases/download/1.14.19b5/uBlock0.chromium.zip
1. run $PATH_TO_CHROME --user-data-dir=/some/empty/directory --load-extension=/location/of/ublock
2. enable block lists you want to use
*/
@davalapar
davalapar / cpu.js
Created October 26, 2019 00:02 — forked from bag-man/cpu.js
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
@davalapar
davalapar / es7-async-await.js
Created May 28, 2019 08:21 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@davalapar
davalapar / index.js
Created April 20, 2019 01:55 — forked from xemasiv/index.js
Notifications
var n = new Notification('Connected', { body: 'Well done mate'} );
setTimeout(() => n.close(), 3000);
Notification.permission;
Notification.requestPermission().then(console.log).catch(console.error);
// https://developer.mozilla.org/en-US/docs/Web/API/notification

XADD streamname [MAXLEN items] * field value [field value ...]

Adds a set of fields with values to the specified stream. If MAXLEN items are exceeded, items are removed from the beginning of the stream to bring the length down to MAXLEN. The "*" field is to autogenerate an item ID, but can be overriden.

Return value

Simple string reply: epoch time (in milliseconds) followed by a .N (for differentiating multiple events on the same millisecond)

@davalapar
davalapar / script.js
Created March 29, 2019 23:38 — forked from Lewiscowles1986/script.js
Anonymous Upload images to Imgur V3 JS
var ImgurAPIKey = 'YEAH-IM-NOT-GIVING-THAT';
window.addEventListener('paste', function(e) {
function eventPreventDefault(e) {
e.preventDefault();
}
function getClipboardData(e) {
return window.clipboardData || e.clipboardData;
}
console.groupWithTrace = (name, fn) => {
console.group(name);
fn();
console.groupCollapsed();
console.trace(name);
console.groupEnd();
console.groupEnd();
};
function add(x, y) {
@davalapar
davalapar / ssecheck.cpp
Created March 6, 2019 09:02 — forked from hi2p-perim/ssecheck.cpp
Check SSE/AVX instruction support.
/*
Check SSE/AVX support.
This application can detect the instruction support of
SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4a, SSE5, and AVX.
*/
#include <iostream>
#ifdef _MSC_VER
#include <intrin.h>
#endif
@davalapar
davalapar / uuid.js
Created January 3, 2019 07:22 — forked from bugventure/uuid.js
UUID regex matching in node.js
function createUUID() {
return uuid.v4();
}
// version 4
// createUUID.regex = '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$';
createUUID.regex = '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$';
createUUID.is = function (str) {
return new RegExp(createUUID.regex).test(str);