Instantly share code, notes, and snippets.

# Aaron Deckera-r-d

• Sort options
Created Dec 8, 2018
 /* * 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 *
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"
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 = []
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
Last active Jan 19, 2020
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 ### ### Basic template algorithm simply initializes the date range and cash. This is a skeleton ### framework you can use for designing an algorithm. ### class BasicTemplateAlgorithm(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def Initialize(self):
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.

``````bootRun {
jvmArgs = ['-Xmx1g']
}
``````
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) { i++; if (typeof stack[j] === 'object') {
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
Created Aug 6, 2017