Skip to content

Instantly share code, notes, and snippets.

View barnjamin's full-sized avatar

Ben Guidarelli barnjamin

View GitHub Profile
package main
import (
"log"
"github.com/ry/v8worker"
)
const OID_LOOKUP = `
var oidmap = {
use_bpm 30
live_loop :piano do
sample :ambi_piano, beat_strech: 2
sleep 2
end
live_loop :amen_break do
with_fx :slicer, phase: 0.5, wave: 0, mix: 1 do
#! /usr/bin/env python
import pyrealsense2 as rs
import numpy as np
import cv2
import sys
import datetime
import os
import json
#!/usr/bin/env python
import numpy as np
from open3d import *
class Node:
def __init__(self, center = [0,0,0], size=0.0, children=[], data=None):
self.center = center
self.size = size
#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
#include <iostream>
#include <fstream>
#include <map>
#include <chrono>
#include <mutex>
#include <thread>
#include "MadgwickAHRS.h" // See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms
#include <Eigen/Geometry>
#include <GL/glut.h>
@barnjamin
barnjamin / quads.py
Last active December 2, 2020 13:43
import numpy as np
AC_EQUITIES = "Equities"
AC_CREDIT = "Credit"
AC_FIXED_INCOME = "Fixed Income"
AC_USD = "USD"
AC_COMMODITIES = "Commodities"
ESEC_TECH = "Tech"
ESEC_FINANCIALS = "Financials"
@barnjamin
barnjamin / BuddyCarterRange
Created April 5, 2020 20:49
Best Attempt at replicating the Buddy Carter Expected Range
//Replicated from here: https://twitter.com/BuddyCA64525731/status/1246051013557211136
study("BuddyCarterRange", "BCR", overlay=true)
atr_lb = input(title="ATR Lookback", defval=60, minval=1, type=input.integer)
sma_lb = input(title="SMA Lookback", defval=10, minval=1, type=input.integer)
bc_range = atr(atr_lb) * sma(tr(true)/atr(atr_lb), sma_lb)/2
function download_txns(name, txns) {
let b = new Uint8Array(0);
for(const txn in txns){
b = concatTypedArrays(b, txns[txn])
}
var blob = new Blob([b], {type: "application/octet-stream"});
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = name;
@barnjamin
barnjamin / poisson_appx.py
Created July 20, 2021 16:41
poisson_appx.py
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def compare(n, p):
return np.sum([abs(stats.poisson.pmf(x, n*p) - stats.binom.pmf(x, n, p)) for x in range(100)])
max_moneysupply = 1e16