Skip to content

Instantly share code, notes, and snippets.

@weisk
weisk / keybase.md
Created September 13, 2019 00:50
keybase

Keybase proof

I hereby claim:

  • I am weisk on github.
  • I am weisk (https://keybase.io/weisk) on keybase.
  • I have a public key ASCAdZ4hPjZv0pTWuOe6ZrtzLEZlwQLUAYT9BRfDYB8LVQo

To claim this, I am signing this object:

/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.OrbitControls = function ( object, domElement ) {
@weisk
weisk / git.md
Created March 1, 2019 04:24
GIT GUD

Git

git remote add : git remote add syngular syngular.es:strategems.git

git pull --rebase upstream branch git pull --rebase origin develop vs. git merge upstream/branch

@weisk
weisk / script.js
Created March 1, 2019 03:21
randomest in js
// window
let array = new Uint32Array(10);
crypto.getRandomValues(array);
// node
crypto.randomBytes(10).toString('utf8');
@weisk
weisk / mongo.js
Last active March 1, 2019 04:20
mongo stuff, aggregation framework
db.auth('admin', '9b2EpmkFtasdfas--wrxo-NVwZp');
const SERIAL = '3e84e930-b6af-11e8-a512-9d2b3d7cbb08';
const DESCRIPTION = 'PLC_1';
const NTAGS = 22;
const MAX_ROWS = 100;
const pipelineBefore = [
{ $match: { serial: SERIAL, description: DESCRIPTION } },
{ $group: { _id: "$date", name: { $first: "$name" }, count: { $sum: 1 }} },
@weisk
weisk / index.js
Created September 30, 2018 21:32
Babel node starter 2018
(async () => {
console.log('hi!');
})()
@weisk
weisk / i18n.js
Created October 7, 2017 22:02
Util.promisify example - read files from directory, parse JSONs, copy
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const { promisify } = require('util');
const { ncp } = require('ncp');
const readDir = promisify(fs.readdir);
const readFile = promisify(fs.readFile);
const copyDir = promisify(ncp);
@weisk
weisk / html5-video-streamer.js
Created June 9, 2017 00:18 — forked from lleo/html5-video-streamer.js
This is an enhancement to Gist#1993068 https://gist.github.com/paolorossi/1993068 . I found what was needed to demonstrate a functioning video stream was a HTML file with a <video> tag pointing to the streamer.
#!/usr/bin/env node
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
* Modified from https://gist.github.com/paolorossi/1993068
*/
var http = require('http')
, fs = require('fs')
, util = require('util')
@weisk
weisk / index.js
Created June 1, 2017 12:36
es2017 node starter boilerplate
import something from './somewhere';
export default function() {
console.log('hi');
}
@weisk
weisk / prime_generator.js
Created September 29, 2016 08:45 — forked from ajace/prime_generator.js
nodejs script to generate prime numbers
#!/usr/bin/env node
var fs = require('fs');
var outfile = "primes.txt";
var count = 0;
var maxCount = 100;
var primes = [];
var i = 2;