Skip to content

Instantly share code, notes, and snippets.

@jtryan
jtryan / yourCustomStrategy.js
Created September 25, 2022 17:53 — forked from arlenner/yourCustomStrategy.js
Tradovate Custom Strategy template.
const { Strategy, TdEvent } = require('../strategies/strategy')
class YourCustomStrategy extends Strategy {
constructor(params) {
super(params)
}
init(props) {
return {
//your initial state here!
@jtryan
jtryan / PriceAxisVolumeDelta.js
Created September 25, 2022 17:53 — forked from arlenner/PriceAxisVolumeDelta.js
Price Axis Volume Delta indicator for the Tradovate platform.
const predef = require("./tools/predef");
const { min, max, du, px, op } = require('./tools/graphics')
class PriceAxisDelta {
init() {
this.byPrice = {}
this.openDate = new Date()
if(this.props.startsYesterday) this.openDate.setTime(Date.now() - 1000*60*60*24)
this.openDate.setHours(this.props.marketOpenHours, this.props.marketOpenMinutes)
@jtryan
jtryan / filebeat-cloudtrail-s3-elasticsearch.json
Created June 30, 2022 20:52 — forked from vindimy/filebeat-cloudtrail-s3-elasticsearch.json
Cloudformation file that sets up Filebeat/Cloudtrail Elasticsearch forwarding (Cloudtrail writes to S3 bucket)
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Elastic SIEM - Filebeat ingestion of Cloudtrail logs from S3",
"Parameters": {
"KeyPair": {
"Type": "AWS::EC2::KeyPair::KeyName",
"Default": "",
"Description": "Name of an existing EC2 KeyPair to enable SSH access"
},

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@jtryan
jtryan / lambdaAMIBackups.py
Created February 5, 2021 17:04 — forked from bkozora/lambdaAMIBackups.py
AWS Lambda AMI Backups
# Automated AMI Backups
#
# @author Bobby Kozora
#
# This script will search for all instances having a tag with the name "backup"
# and value "Backup" on it. As soon as we have the instances list, we loop
# through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
@jtryan
jtryan / pubkey-from-pem.md
Created February 25, 2020 19:13
Retrieve AWS public key from .pem file
ssh-keygen -y -f key.pem > key.pub
@jtryan
jtryan / zipline_install.md
Created February 17, 2020 15:46
Install zipline on ubuntu
  1. Install needed libraries
sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev cython
pt-get install libhdf5-serial-dev
  1. Create python virtual_env
  2. chenage to virtaul env
  3. Install table -- crashes during zipline install
export HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ 
@jtryan
jtryan / .bashrc
Created February 19, 2019 14:32 — forked from miguelmota/.bashrc
Show host IP address on your bash prompt.
# Show host IP address on your bash prompt.
#
# Example of prompt:
#
# moogs@192.168.1.100 : ~/Dropbox/workspace
# $
#
export PS1="\n\n\[\033[0;36m\]\u@$(ifconfig | grep "inet " | grep -v 127.0.0. | awk '{print $2}')\[\033[00m\]\[\033[0;32m\] : \w\[\033[00m\]\n\[\033[00;32m\]\$\[\033[00m\] "
export PS2="\[\033[0;32m\]>\[\033[00m\] "
set nocompatible
set tabstop=4
set shiftwidth=4
set expandtab
set hlsearch
set incsearch
set guioptions-=e
@jtryan
jtryan / opencv3-osx.md
Last active April 26, 2018 17:52
opencv3 on os x - April 2018

Brew has changed the opncv3 cask.

It is now part of core and has lost the ability to use cli argument on install

  1. Install brew
  2. brew install python
  3. brew install python3
  4. brew install opencv
  5. pip install virtualenv virtualenvwrapper

Now do some cleanup.