Skip to content

Instantly share code, notes, and snippets.

@kevincdurand1
kevincdurand1 / PermissionsPerFile.ps1
Created December 8, 2020 21:40
Get NTFS File Permissions Using PowerShell
$FolderPath = Get-ChildItem -Directory -Path "C:\temp\" -Recurse -Force
$Output = @()
ForEach ($Folder in $FolderPath) {
$Acl = Get-Acl -Path $Folder.FullName
ForEach ($Access in $Acl.Access) {
$Properties = [ordered]@{'Folder Name'=$Folder.FullName;'Group/User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
$Output += New-Object -TypeName PSObject -Property $Properties
}
}
$Output | Out-GridView
@kevincdurand1
kevincdurand1 / series_to_supervised.py
Last active January 28, 2020 19:18
Covert Time series to Supervised
# https://www.kaggle.com/dimitreoliveira/deep-learning-for-time-series-forecasting
def series_to_supervised(data, window=1, lag=1, dropnan=True):
cols, names = list(), list()
# Input sequence (t-n, ... t-1)
for i in range(window, 0, -1):
cols.append(data.shift(i))
names += [('%s(t-%d)' % (col, i)) for col in data.columns]
# Current timestep (t=0)
cols.append(data)
@kevincdurand1
kevincdurand1 / BuildNeuralNetworkDemo.cs
Created April 18, 2019 19:18 — forked from atifaziz/BuildNeuralNetworkDemo.cs
Neural Network Demo with C# by James McCaffrey, MSR and Build 2013 versions
// http://channel9.msdn.com/Events/Build/2013/2-401
// http://www.quaetrix.com/Build2013.html
using System;
// For 2013 Microsoft Build Conference attendees
// June 25-28, 2013
// San Francisco, CA
//
// This is source for a C# console application.
@kevincdurand1
kevincdurand1 / series_to_supervised.py
Created March 20, 2019 01:23
series_to_supervised.py
from pandas import DataFrame
from pandas import concat
def series_to_supervised(data, n_in=1, n_out=1, dropnan=True):
"""
Frame a time series as a supervised learning dataset.
Arguments:
data: Sequence of observations as a list or NumPy array.
n_in: Number of lag observations as input (X).
n_out: Number of observations as output (y).
@kevincdurand1
kevincdurand1 / test_stationarity.py
Last active June 1, 2018 02:44
test_stationarity.py
from pandas import Series
from statsmodels.tsa.stattools import adfuller
def test_stationarity(timeseries, windowroll = 12, cutoff = 0.05):
#Determing rolling statistics
rolmean = pd.rolling_mean(timeseries, window=windowroll)
rolstd = pd.rolling_std(timeseries, window=windowroll)
#Plot rolling statistics:
orig = plt.plot(timeseries, color='blue',label='Original')
mean = plt.plot(rolmean, color='red', label='Rolling Mean')
std = plt.plot(rolstd, color='black', label = 'Rolling Std')
SELECT [DateTime], [Close]
,(log([Close]) - log(LAG ([Close],1) OVER (ORDER BY [DateTime])))*100 AS LogReturn
FROM [EURUSD_Daily_198001020000_201805180000_Quant]
@kevincdurand1
kevincdurand1 / PercentChange.sql
Created May 23, 2018 23:10
PercentChange.sql
SELECT [DateTime]
,([Close] - LAG ([Close],1) OVER (ORDER BY [DateTime]))/LAG ([Close],1) OVER (ORDER BY [DateTime])*100 AS pct_change_close_1
,([Close] - LAG ([Close],2) OVER (ORDER BY [DateTime]))/LAG ([Close],2) OVER (ORDER BY [DateTime])*100 AS pct_change_close_2
,([Close] - LAG ([Close],3) OVER (ORDER BY [DateTime]))/LAG ([Close],3) OVER (ORDER BY [DateTime])*100 AS pct_change_close_3
,([Close] - LAG ([Close],4) OVER (ORDER BY [DateTime]))/LAG ([Close],4) OVER (ORDER BY [DateTime])*100 AS pct_change_close_4
,([Close] - LAG ([Close],5) OVER (ORDER BY [DateTime]))/LAG ([Close],5) OVER (ORDER BY [DateTime])*100 AS pct_change_close_5
,([Close] - LAG ([Close],6) OVER (ORDER BY [DateTime]))/LAG ([Close],6) OVER (ORDER BY [DateTime])*100 AS pct_change_close_6
,([Close] - LAG ([Close],7) OVER (ORDER BY [DateTime]))/LAG ([Close],7) OVER (ORDER BY [DateTime])*100 AS pct_change_close_7
,([Close] - LAG ([Close],8) OVER (ORDER BY [DateTime]))/LAG ([Close],8) OVER (ORDER BY [DateTime])*100 AS pct_change_close_8
,([Cl
@kevincdurand1
kevincdurand1 / Create a Web API with Flask.py
Created May 22, 2018 02:28
Create a Web API with Flask.py
from flask import *
app = Flask(__name__)
@app.route('/post', methods = ['POST'])
def post():
json = request.json
encoded = request.form
cp1_ = (encoded.get("cp1"))
cp2_ = (encoded.get("cp2"))
cp3_ = (encoded.get("cp3"))
cp4_ = (encoded.get("cp4"))
@kevincdurand1
kevincdurand1 / Percent_Change.Sql
Created May 20, 2018 18:53
Percent Change.Sql
SELECT [DateTime],[Close]
,([Close] - LAG ([Close],1) OVER (ORDER BY [DateTime]))/LAG ([Close],1) OVER (ORDER BY [DateTime])*100 AS PCT_CHANGE_CLOSE
FROM [dbsec].[dbo].[EURUSDM1FiboMA];
select *
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 1 THEN SUM([Close]) OVER (ORDER BY [Datetime] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) END/2 as MA2
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 2 THEN SUM([Close]) OVER (ORDER BY [Datetime] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) END/3 as MA3
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 4 THEN SUM([Close]) OVER (ORDER BY [Datetime] ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) END/4 as MA5
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 7 THEN SUM([Close]) OVER (ORDER BY [Datetime] ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) END/8 as MA8
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 12 THEN SUM([Close]) OVER (ORDER BY [Datetime] ROWS BETWEEN 12 PRECEDING AND CURRENT ROW) END/13 as MA13
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 20 THEN SUM([Close]) OVER (ORDER BY [Datetime] ROWS BETWEEN 20 PRECEDING AND CURRENT ROW) END/21 as MA21
,CASE WHEN ROW_NUMBER() OVER (ORDER BY [Datetime]) > 33 THEN SUM([Close]) OVER (OR