Skip to content

Instantly share code, notes, and snippets.

View jcorrius's full-sized avatar

Jesús Corrius jcorrius

View GitHub Profile
@jcorrius
jcorrius / distributions
Created November 15, 2018 10:02
Sample distributions file for a Debian repo
Origin: Bluekiri Demo
Label: bluekiri
Codename: bionic
Architectures: amd64
Components: main
Description: Personal repository
SignWith: B501DE17DA19A16F
@jcorrius
jcorrius / demoapi.service
Created November 15, 2018 09:18
Debian service file sample
[Unit]
Description=Demo Api Service
After=network.target
[Service]
Type=simple
ExecStart=/opt/bluekiri/demoapi/demoapi
ExecReload=/bin/kill -HUP $MAINPID
[Install]
@jcorrius
jcorrius / rules
Created November 15, 2018 08:43
Debian rules file sample
#!/usr/bin/make -f
#export DH_VERBOSE = 1
%:
dh $@ --with=systemd
override_dh_auto_build:
dotnet publish -c Release --self-contained -r ubuntu.18.04-x64
# auto-build disabled
@jcorrius
jcorrius / control
Created November 15, 2018 07:35
Debian control file sample
Source: demoapi
Section: net
Priority: optional
Maintainer: Bluekiri Demo <[email protected]>
Build-Depends: debhelper (>= 10), dh-systemd
Standards-Version: 4.1.2
Homepage: https://github.com/bluekiri/demoapi
Package: demoapi
Architecture: any
@jcorrius
jcorrius / changelog
Created November 15, 2018 07:29
Debian changelog file sample
demoapi (1.0-0ubuntu1) bionic; urgency=medium
* Initial Release.
-- Bluekiri Demo <[email protected]> Tue, 13 Nov 2018 08:23:08 +0000
@jcorrius
jcorrius / demoapi.csproj
Created November 14, 2018 15:15
.NET Core csproj sample for a self-contained project
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeIdentifiers>ubuntu.18.04-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
@jcorrius
jcorrius / johansen.py
Created September 24, 2018 06:29
Calculate Johansen Test for the given time series
import numpy as np
from statsmodels.tsa.tsatools import lagmat
def johansen(ts, lags):
"""
Calculate the Johansen Test for the given time series
"""
# Make sure we are working with arrays, convert if necessary
ts = np.asarray(ts)
@jcorrius
jcorrius / cointegrated_adf.py
Created September 24, 2018 06:26
Cointegrated Augmented Dickey-Fuller Test
import numpy as np
from statsmodels.regression.linear_model import OLS
from statsmodels.tsa.tsatools import lagmat, add_trend
from statsmodels.tsa.adfvalues import mackinnonp
def adf(ts, maxlag=1):
"""
Augmented Dickey-Fuller unit root test
"""
# make sure we are working with an array, convert if necessary
@jcorrius
jcorrius / half_life.py
Created September 18, 2018 15:20
Half-Life of Mean Reversion
import numpy as np
def half_life(ts):
"""
Calculates the half life of a mean reversion
"""
# make sure we are working with an array, convert if necessary
ts = np.asarray(ts)
# delta = p(t) - p(t-1)
@jcorrius
jcorrius / variance_ratio.py
Created September 18, 2018 15:19
Variance Ratio Test
import numpy as np
def variance_ratio(ts, lag = 2):
"""
Returns the variance ratio test result
"""
# make sure we are working with an array, convert if necessary
ts = np.asarray(ts)
# Apply the formula to calculate the test