Skip to content

Instantly share code, notes, and snippets.

View a-r-d's full-sized avatar
🍌

Aaron Decker a-r-d

🍌
View GitHub Profile
@a-r-d
a-r-d / check-addr-from-xpub.py
Last active October 26, 2023 03:30
How to correctly check a native segwit address if its derived from an a given xpub
"""
This works as of October 2023
pip3 install bitcoinlib
"""
from bitcoinlib.keys import HDKey
def check_address_in_xpub(xpub, address_to_check, segwit_type):
@a-r-d
a-r-d / keybase.md
Created July 15, 2021 22:00
keybase

Keybase proof

I hereby claim:

  • I am a-r-d on github.
  • I am a_r_d (https://keybase.io/a_r_d) on keybase.
  • I have a public key ASD4gHJYd1VQoZ7CBS4AH1UQJjHXMOzniVPPT-TKpCXZWgo

To claim this, I am signing this object:

const Alpaca = require('@alpacahq/alpaca-trade-api')
const getKeyId = () => process.env.APCA_API_KEY_ID
const getSecretKey = () => process.env.APCA_API_SECRET_KEY
export const alpaca = new Alpaca({
keyId: getKeyId(),
secretKey: getSecretKey(),
paper: false,
usePolygon: false,
@a-r-d
a-r-d / other-misc-data-assets-v1-INVALID.json
Last active June 18, 2020 20:37
data asset demo public
[
{"Country Code":"USA","Established Customers":"5009","Total Customers":"3900343","Pct Active Accounts":"90"},
{"Country Code":"CAN","Established Customers":"3389","Total Customers":"300043","Pct Active Accounts":"80"},
{"Country Code":"MEX","Established Customerz":"2890","Total Customers":"zzzz","Pct Active Accounts":"70"}
]
@a-r-d
a-r-d / fade_complex.ino
Created December 8, 2018 19:48
Some RGB fade arduino code
/*
* Code for cross-fading 3 LEDs, red, green and blue (RGB)
* To create fades, you need to do two things:
* 1. Describe the colors you want to be displayed
* 2. List the order you want them to fade in
*
* DESCRIBING A COLOR:
* A color is just an array of three percentages, 0-100,
* controlling the red, green and blue LEDs
*
@a-r-d
a-r-d / playing_with_elevatr.R
Last active April 10, 2018 17:40
playing with elevatr public AWS data not authed
library(rgdal)
library(elevatr)
# this is the prjection system given as example in the documentation
ll_prj <- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"
# Im using this projection system based on reading this document:
# https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/OverviewCoordinateReferenceSystems.pdf
us_prj = "+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"
@a-r-d
a-r-d / scale.py
Created March 8, 2018 20:25
how to scale factors
def featureScaling(arr):
_max = 0
_min = 10000000
for a in arr:
if a < _min:
_min = a
if a > _max:
_max = a
scaled = []
@a-r-d
a-r-d / main.py
Created February 22, 2018 01:42
Basic sector rebalance monthly algorithm
import numpy as np
class BasicTemplateAlgorithm(QCAlgorithm):
'''Basic template algorithm simply initializes the date range and cash'''
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2004, 1, 1) #Set Start Date
self.SetEndDate(2018, 2, 16) #Set End Date
self.SetCash(100000) #Set Strategy Cash
@a-r-d
a-r-d / hold-tlt-version.py
Last active May 18, 2021 13:40
QuantConnect - simple MACD strategy against SPY, 50/150 day cross, long and short, leverage is none
import numpy as np
### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class BasicTemplateAlgorithm(QCAlgorithm):
'''Basic template algorithm simply initializes the date range and cash'''
def Initialize(self):
@a-r-d
a-r-d / memory.md
Created January 30, 2018 16:15
A million ways to change HEAP memory in Java

Xmx vs Xms

Remember, Xmx corresponds to max heap and Xms corresponds to starting heap. It can be an optimization to set these equal.

In Spring Boot build.gradle

bootRun {
      jvmArgs = ['-Xmx1g']
}