Skip to content

Instantly share code, notes, and snippets.

View modster's full-sized avatar

EM Greeff modster

View GitHub Profile
@modster
modster / nodejs-tcp-example.js
Created September 15, 2018 07:35 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
{
"lng": "-114.062525",
"lat": "51.053065",
"title": "Calgary"
}
@modster
modster / .block
Created September 27, 2019 14:54
TechanJS Candlestick chart with tooltips
license: mit
@modster
modster / binance-node-api
Last active October 6, 2019 03:06
Highchart market depth binance-node-api
// by jaggedsoft https://github.com/binance-exchange/node-binance-api/issues/111#issuecomment-370715955
const file = require('fs');
binance.websockets.depthCache(['BTCUSDT','BNBBTC'], (symbol, depth) => {
const limit = 1000;
let bids = binance.sortBids(depth.bids, limit, 'cumulative');
let asks = binance.sortAsks(depth.asks, limit, 'cumulative');
console.log(symbol+" depth cache update");
console.log("best bid: "+binance.first(bids));
console.log("best ask: "+binance.first(asks));
let output = {bids:binance.array(bids), asks:binance.array(asks)};
@modster
modster / workbench.colorCustomizations.json
Created November 18, 2019 16:49 — forked from jacklorusso/workbench.colorCustomizations.json
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@modster
modster / .block
Created November 19, 2019 16:18
fresh block
license: mit
@modster
modster / .block
Created November 19, 2019 16:18
fresh block
license: mit
@modster
modster / scroll.js
Created March 12, 2020 17:08
scroll page to end of document with nodejs puppeteer
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const [page] = await browser.pages();
await page.goto('https://www.reddit.com/r/GameDeals/', { waitUntil: 'networkidle0' });
const links = await page.evaluate(async () => {
window.scrollBy(0, document.body.clientHeight);
await new Promise(resolve => setTimeout(resolve, 5000)); // wait for some time, you might need to figure out a good value for this yourself
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
{
"name": "< R E P O N A M E >",
"version": "1.0.0",
"description": "A bot that uses TradingView alerts to buy/sell crypto on the Binance Futures API.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"nodejs",