Skip to content

Instantly share code, notes, and snippets.

View syzer's full-sized avatar
🐕
Woof! Woof!

syzer syzer

🐕
Woof! Woof!
View GitHub Profile
@max-mapper
max-mapper / difflint
Last active May 30, 2021 03:26
Run eslint + prettier on only files that you've staged/commited on the current branch
#!/usr/bin/env bash
# chmod +x this and save in your PATH. Assumes `eslint` + `prettier` are in your `devDependencies`
BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
BASE=$(git merge-base master $BRANCH) # change master to whatever your trunk branch is
COMMITED=$(git diff --name-only $BASE $BRANCH)
STAGED=$(git diff --staged --name-only)
FILES=$(printf "$COMMITED\n$STAGED" | sort | uniq)
LINT="npx eslint --ignore-path=.prettierignore $FILES"
PRETTIER="npx prettier --list-different $FILES"
@mauricedb
mauricedb / Subject under test
Last active December 7, 2023 14:46
Testing stateful React hooks
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
}
@jdrew1303
jdrew1303 / readme.md
Last active April 2, 2024 20:34
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

@yurifrl
yurifrl / normalizer.js
Last active June 2, 2022 10:46
ramda, convert properties of objet into snakeCase or camelCase
import { concat, zipObj, keys, values, map, isEmpty, curry } from 'ramda'
const log = curry(console.log)
const snakeCaseObj = [{
a_b: "asdasdasd",
c_a: "2018-02-20T18:43:17.104Z",
t_c: {
s_d: "2018-02-20",
e_d: "2018-02-20",
b_t: {
c_a: "2018-02-20T18:43:17.104Z"
'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
*/
@qwtel
qwtel / getFiles.js
Last active September 9, 2023 13:43
[node.js 8+] Recursively get all files in a directory
// Node 8+
// --------------------------------------------------------------
// No external dependencies
const { promisify } = require('util');
const { resolve } = require('path');
const fs = require('fs');
const readdir = promisify(fs.readdir);
const stat = promisify(fs.stat);
@bbrewer97202
bbrewer97202 / index.js
Created October 20, 2016 17:15
Graphicsmagick gm convert svg string buffer to sized jpg with 300 DPI setting
var gm = require('gm');
var source = '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 2550 3300" enable-background="new 0 0 2550 3300" xml:space="preserve"><g><path fill="#53381A" stroke="#1C1308" d="M807.6,1092.5L527.3,1067c-636.9-25.5-509.5,0-458.6,509.5c51,203.8,0,331.2,254.8,331.2 L807.6,1092.5z"/><path fill="#8A5B28" stroke="#1C1308" d="M909.5,1143.5H629.2c-636.9-25.5-509.5,0-458.6,509.5c51,203.8,25.5,305.7,305.7,229.3 L909.5,1143.5z"/><path fill="#454F2E" stroke="#1C1308" d="M807.6,990.6c127.4-254.8,76.4-305.7,458.6-254.8c509.5,127.4,509.5,152.9,891.6,152.9 c254.8,25.5,509.5,101.9,254.8,407.6l-280.2,509.5H450.9L807.6,990.6z"/><path fill="#76894C" stroke="#1C1308" d="M323.5,1703.9v178.3l1146.4,458.6v-178.3L323.5,1703.9z M807.6,990.6 c127.4-254.8,76.4-305.7,382.1-203.8c509.5,152.9,254.8,152.9,789.7,152.9c254.8,25.5,458.6,101.9,254.8,407.6L1954,1856.8 L527.3,1627.5L807.6,990.6z"/
@morgangiraud
morgangiraud / nvidia-reinstall.sh
Last active December 11, 2020 15:48
Script to reinstall manually nvidia drivers,cuda 9.0 and cudnn 7.1 on Ubuntu 16.04
# Remove anything linked to nvidia
sudo apt-get remove --purge nvidia*
sudo apt-get autoremove
# Search for your driver
apt search nvidia
# Select one driver (the last one is a decent choice)
sudo apt install nvidia-370
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@arundasan91
arundasan91 / CaffeInstallation.md
Created April 2, 2016 22:16
Caffe Installation Tutorial for beginners

Caffe

Freshly brewed !

With the availability of huge amount of data for research and powerfull machines to run your code on, Machine Learning and Neural Networks is gaining their foot again and impacting us more than ever in our everyday lives. With huge players like Google opensourcing part of their Machine Learning systems like the TensorFlow software library for numerical computation, there are many options for someone interested in starting off with Machine Learning/Neural Nets to choose from. Caffe, a deep learning framework developed by the Berkeley Vision and Learning Center (BVLC) and its contributors, comes to the play with a fresh cup of coffee.

Installation Instructions (Ubuntu 14 Trusty)

The following section is divided in to two parts. Caffe's documentation suggest