Skip to content

Instantly share code, notes, and snippets.

@rm-rf-etc
rm-rf-etc / index.html
Last active April 22, 2018 10:58
SVG sine wave
<!DOCTYPE html>
<html>
<head>
<style>
html, body { width: 100%; height: 100%; margin: 0; padding: 0; }
body { position: relative; }
div { position: relative; margin: auto; width: fit-content; margin-top: calc(50vh - 200px); }
</style>
</head>
<body>
@rm-rf-etc
rm-rf-etc / arango-init.sh
Created August 8, 2018 02:32
Install the ArangoDB Operator into a Kubernetes cluster
#!/bin/bash
# Installs the ArangoDB Operator into a Kubernetes cluster
LOCAL_STORAGE_YAML="\
apiVersion: storage.arangodb.com/v1alpha
kind: ArangoLocalStorage
metadata:
name: example-arangodb-storage
spec:
storageClass:
#!/bin/bash
###################
## SAMPLE OUTPUT ##
###################
: <<'END'
Press Ctrl-C to exit at any point
Please enter a name for this cluster: prod1
@rm-rf-etc
rm-rf-etc / The_Thunk_Emperor_Has_No_Clothes.js
Last active July 11, 2019 21:31
The Thunk Emperor Has No Clothes
/******************************\
The Thunk Emperor Has No Clothes
\******************************/
/* ACT ONE
myAction:
"I'm an action creator!"
@rm-rf-etc
rm-rf-etc / do_query.js
Last active October 24, 2019 03:04
Cayley Graph Database Example - Get user with friends
function predicatesToList(thingId) {
var thing = g.V(thingId);
var result = [];
thing.outPredicates().map(function(a){
if (!a) return;
thing.out(a.id).map(function(b){
result.push([a.id, b.id]);
});
@rm-rf-etc
rm-rf-etc / includes.js
Last active December 26, 2019 06:38
Basics of using ES Modules
export const add = (a, b) => a + b;
export const subtract = (a, b) => a - b;
export default { add, subtract };
@rm-rf-etc
rm-rf-etc / omit.js
Last active December 26, 2019 07:22
Removes the `_` property from every level of a nest gun.js data node.
import omit from "lodash.omit";
import keys from "lodash.keys";
export default (ref1) => {
if (typeof ref1 !== "object") return ref1;
function stripProp(prop, ref2) {
if (typeof ref2[prop] !== "object") return;
/* eslint-disable-next-line no-param-reassign */
ref2[prop] = omit(ref2[prop], "_");
@rm-rf-etc
rm-rf-etc / index.ts
Last active March 30, 2020 08:53
Database-to-JSON Adapter
import { sha256 } from "sha.js";
type Data = {
[k: string]: {
[k: string]: string | number | boolean,
}
};
const data: Data = {};
@rm-rf-etc
rm-rf-etc / ha-candles-backtest.py
Created November 18, 2020 22:14
HA Candles Backtest
import yfinance as yf
import pandas as pd
import numpy as np
import pandas_datareader as pdr
import matplotlib.pyplot as plt
import plotly
import plotly.graph_objects as go
yf.pdr_override()
stock = yf.Ticker("SPY")
@rm-rf-etc
rm-rf-etc / intrinsic_time.py
Last active December 24, 2020 22:59
Intrinsic Time implementation, from the Alpha Engine whitepaper
class IntrinsicTimeBar:
reversal: False
direction: None
time: None
high: None
low: None
def __init__(self, time, high: float, low: float, direction=None, reversal=False):
self.reversal = reversal
self.direction = direction