Skip to content

Instantly share code, notes, and snippets.

View linuskohl's full-sized avatar
🙏

Linus Kohl linuskohl

🙏
View GitHub Profile
@linuskohl
linuskohl / .gitlab-ci.yml
Created August 18, 2019 13:26
GitLab CI/CD for deploying a React app to an AWS S3 bucket
# GitLab CI/CD Variables
# AWS_S3_BUCKET_PROD: S3 bucket that hosts production files
# AWS_S3_BUCKET_DEV: S3 bucket that hosts development files
# AWS_ACCESS_KEY_ID: AWS Key ID
# AWS_SECRET_ACCESS_KEY: AWS Secret
stages:
- build
- deploy
@linuskohl
linuskohl / naive-benchmark-on-news-headlines.py
Created June 4, 2019 16:19
Naive benchmark of AmbiverseNLU on news headlines
# pip install newsapi-python
import time
import pandas as pd
import numpy as np
import seaborn as sns
from newsapi import NewsApiClient
newsapi = NewsApiClient(api_key=API_KEY)
# get 100 latest news items
top_news = newsapi.get_top_headlines(language='en', page_size=100)
@linuskohl
linuskohl / ambiverseclient-sample.py
Last active June 4, 2019 15:04
Sample code for medium article
# import client and input model
from ambiverseclient.clients import AmbiverseNLU, KnowledgeGraph
from ambiverseclient.models import AnalyzeInput
# specify the API endpoints
a_endpoint = AmbiverseNLU_ENDPOINT
kg_endpoint = KnowledgeGraph_ENDPOINT
# setup the clients
a_client = AmbiverseNLU(a_endpoint, port=8080)
@linuskohl
linuskohl / lee_mykland_jumps.py
Created April 8, 2019 08:15
Python Implementation of the Jump Detection Algorithm as described in the Paper "Jumps in Equilibrium Prices and Market Microstructure Noise" by Suzanne S. Lee and Per A. Mykland
from math import ceil, sqrt
import numpy as np
import pandas as pd
def movmean(v, kb, kf):
"""
Computes the mean with a window of length kb+kf+1 that includes the element
in the current position, kb elements backward, and kf elements forward.
Nonexisting elements at the edges get substituted with NaN.
@linuskohl
linuskohl / tracking.js
Created January 24, 2019 15:26
Insights Cookie Consent Google Analytics Opt-Out Solution
var gaProperty = 'UA-XXXXXXXX-X';
// Get the name of the GA tracking disable cookie
var disableStr = 'ga-disable-' + gaProperty;
// Check if GA cookie exists
window[disableStr] = (document.cookie.indexOf(disableStr + '=true') > -1)
// Opt-out function
function gaOptout() {

Keybase proof

I hereby claim:

  • I am linuskohl on github.
  • I am linuskohl (https://keybase.io/linuskohl) on keybase.
  • I have a public key ASBe5pRAYVrsgPvHl3Qyi0M8NSLVuPfTOXX0tHtO-d_WpQo

To claim this, I am signing this object:

@linuskohl
linuskohl / CustomSerializer.php
Created August 20, 2018 20:21
Custom Yii2 serializer that allows masking and setting default fields and expands
<?php
namespace app\components;
use yii\base\InvalidConfigException;
/**
* Class CustomSerializer
*
* Serializer