Skip to content

Instantly share code, notes, and snippets.

View patch_policies.sh
#!/bin/bash -x
echo "Script started";
echo "Downloading the Ranger policy patch script";
wget -O /tmp/patch_policy_esp.py https://hdiconfigactions.blob.core.windows.net/linuxhdiplclusterconfigactionv01/patch_policy_esp.py
sudo python /tmp/patch_policy_esp.py
echo "Scripts Finished"
@ivannp
ivannp / format_default
Created Feb 16, 2018
format/default to support lib.ivannp
View format_default
#
# Copyright (C) 1996-2001, Thomas Andrews
#
# $Id: default 277 2008-10-27 17:36:14Z thomasoa $
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@ivannp
ivannp / rallies.r
Last active Nov 28, 2017
POTUS Rallies since Election Day
View rallies.r
require(quantmod)
require(ggplot2)
require(ggthemes)
# The starting index in the elections dates and president's arrays
# start.index = 7
start.index = 6
# sp = getSymbols("^GSPC", from="1900-01-01", auto.assign=F)
sp = as.xts(read.csv.zoo('dji.csv', format='%Y%m%d', header=F, sep=",")[,1:4])
View wfl_tensorflow.py
import dshelper as dsh
import instrumentdb as idb
import logging
import numpy as np
import os
import pandas as pd
import psutil
import sys
import tensorflow as tf
import time
@ivannp
ivannp / m4b2mp3.py
Created Feb 12, 2017
Converting files (.m4b to .mp3) in python
View m4b2mp3.py
import glob
import os
import subprocess
def main():
base_dir = os.path.abspath('d:/abooks')
ffmpeg_path = os.path.abspath('C:/tools/ffmpeg/bin/ffmpeg.exe')
pattern = os.path.join(base_dir, '**', '*.m4b')
View cntk_classifier.py
import cntk
import cntk.ops as C
import numpy as np
from sklearn.preprocessing import OneHotEncoder
from cntk.blocks import default_options, Input # Building blocks
from cntk.initializer import glorot_uniform
from cntk.layers import Dense # Layers
from cntk.learner import sgd, learning_rate_schedule, UnitType
@ivannp
ivannp / mlloop.py
Last active Nov 5, 2018
Walk-Forward Machine Learning Loop
View mlloop.py
import dshelper as dsh
import numpy as np
import os
import pandas as pd
import sys
import time
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis as QDA
from sqlalchemy import create_engine, MetaData
@ivannp
ivannp / opportunities.py
Last active Aug 16, 2017
Discovering trading opportunities in price series and generating possible predictors
View opportunities.py
import pandas as pd
import numpy as np
import instrumentdb as idb
import math
import pickle
def good_entries(ohlcv, min_days = 3, days_out = 15, vola_len = 35, days_pos = 0.6, stop_loss = 1.5):
if days_out <= min_days:
raise RuntimeError('days_out must be greater than min_days.')
View csidb.py
'''
A module to load instruments and bars from a SQLite database.
'''
import pandas as pd
import toml
from sqlalchemy import create_engine
class CsiDb:
View Yahoo Access via R6
require(R6)
require(quantmod)
# Db interface
YahooDb = R6Class("YahooDb",
public = list(
initialize = function(path="yahoo.sqlite") {
private$path = path
},
You can’t perform that action at this time.