Skip to content

Instantly share code, notes, and snippets.

Aaron Decker a-r-d

Block or report user

Report or block a-r-d

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@a-r-d
a-r-d / fade_complex.ino
Created Dec 8, 2018
Some RGB fade arduino code
View fade_complex.ino
/*
* 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 Apr 10, 2018
playing with elevatr public AWS data not authed
View playing_with_elevatr.R
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 Mar 8, 2018
how to scale factors
View scale.py
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 Feb 22, 2018
Basic sector rebalance monthly algorithm
View main.py
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 Aug 9, 2019
QuantConnect - simple MACD strategy against SPY, 50/150 day cross, long and short, leverage is none
View hold-tlt-version.py
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 Jan 30, 2018
A million ways to change HEAP memory in Java
View memory.md

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']
}
@a-r-d
a-r-d / traverse.js
Created Dec 7, 2017
traverse objects iteratively
View traverse.js
function traverse(obj) {
var stack = [];
var i = 0;
stack.push(obj);
while (stack.length) {
for (var j in stack[0]) {
i++;
if (typeof stack[0][j] === 'object') {
@a-r-d
a-r-d / async-await.js
Created Nov 18, 2017
Async Await gentle introduction
View async-await.js
// function that returns a promise
function getAMessage() {
return new Promise(resolve => {
setTimeout(() => {
resolve("passing this value back...");
}, 2000);
});
}
// function is marked async
View gist:f68a6999565f9426a89397a68c5f81ba
0x683A802cB2346CB769dd0E3D7FaCcf08d1073fBE
@a-r-d
a-r-d / ExampleMultipleStringsToList.java
Created Nov 22, 2016
An example of converting multiple lines to single array split on space chars.
View ExampleMultipleStringsToList.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class ExampleMultipleStringsToList {
public static void main(String[] args) {
// read in a line
Scanner scanner = new Scanner(System.in);
You can’t perform that action at this time.