Skip to content

Instantly share code, notes, and snippets.

View mikolalysenko's full-sized avatar

Mikola Lysenko mikolalysenko

View GitHub Profile
@mikolalysenko
mikolalysenko / analyze-security.js
Created July 16, 2021 20:55
GME loan scraping
const fs = require('fs');
const path = require('path');
const ticker = 'gme';
const re = new RegExp(`${ticker.toUpperCase()}\\s+,\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)\\s*,\\s*`);
console.log('Date,Market Loan-Loan Balance,Hedge-Loan Balance,');
(async () => {
Date Market Loan-Loan Balance Hedge-Loan Balance
4/1/2021 6300000.00 521949429.00
5/1/2021 6300000.00 543554502.00
6/1/2021 5846300.00 580727376.00
7/1/2021 8143400.00 574553466.00
8/1/2021 9093400.00 580071211.00
11/1/2021 13755000.00 627710704.00
12/1/2021 13755000.00 661710954.00
13/1/2021 21615000.00 1075260407.00
14/1/2021 26900100.00 1350479619.00
@mikolalysenko
mikolalysenko / scrape-occ.js
Created July 16, 2021 20:28
scrapes loan data from occ
const fetch = require('node-fetch');
const fs = require('fs');
const startDate = new Date(2021, 0);
const endDate = new Date();
const msPerDay = 86400000;
const fetchDelayMS = 1000;
function pad(s, d) {
while (s.length < d) {
{
"chart": {
"result": [
{
"meta": {
"currency": "USD",
"symbol": "GME",
"exchangeName": "NYQ",
"instrumentType": "EQUITY",
"firstTradeDate": 1013610600,
// install:
//
// npm install ndarray parse-magica-voxel
//
// usage:
//
// node vox-to-box.js my-file.vox > my-file.terrain
//
const parseMagicaVoxel = require('parse-magica-voxel')
const HelNumber = require('helschema/number')
const HelString = require('helschema/string')
const HelStruct = require('helschema/struct')
const HelDictionary = require('helschema/dictionary')
const EntitySchema = HelStruct({
x: HelNumber,
y: HelNumber,
color: HelString
})
const regl = require('regl')()
const video = document.createElement('video')
video.src = 'mario.mp4'
video.currentTime = window.localStorage.getItem('currentTime') | 0
function persistVideoLocation () {
window.localStorage.setItem('currentTime', video.currentTime)
}
const regl = require('regl')()
const drawCircle = regl({
attributes: {
p: [0] // dummy attribute
},
frag: `
precision highp float;
uniform vec3 color;
{
blend: {
enable: true,
func: {
src: 'dst color',
dst: 'one minus src alpha'
},
equation: 'add'
}
}