Skip to content

Instantly share code, notes, and snippets.

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@seahrh
seahrh / wsl-setup.md
Created September 10, 2020 04:12 — forked from imfing/wsl-setup.md
WSL + ZSH + Hyper Setup

My WSL Setup

A guide to setup your WSL with Hyper and zsh

Download & Install the WSL

  • Follow the very thorough instructions here

Get a prettier terminal

  • Download Hyper.js here - I went with the 'hyperblue' theme.
@seahrh
seahrh / argmin_argmax.py
Created August 5, 2020 23:28
argmin, argmax in Python3
from typing import Iterable, TypeVar
T = TypeVar("T")
def argmin(elements: Iterable[T]) -> int:
"""Returns first index of smallest element."""
return min(enumerate(elements), key=lambda x: x[1])[0]
@seahrh
seahrh / timestamp_pattern.py
Created July 30, 2020 11:29
Python3 regex match timestamp pattern
import re
from typing import List, Set
filename = ""
out_filename = ""
records: List[str] = []
ts_pattern = re.compile(r"^.+(\d{2}/\w{3}/\d{4}:\d{2}:\d{2}:\d{2})")
seen: Set[str] = set()
@seahrh
seahrh / linear_regression.py
Created July 5, 2020 04:30
Simple linear regression example (sklearn, L1 regularization)
import os
import random
import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.pipeline import Pipeline
from sklearn.model_selection import cross_val_score, GridSearchCV
from sklearn.preprocessing import RobustScaler
from sklearn.decomposition import PCA
from sklearn import metrics
@seahrh
seahrh / arima_forecast_example.py
Last active August 1, 2020 08:43
ARIMA / SARIMA examples (forecast method works but not predict)
#!/bin/python3
import math
import os
import random
import re
import sys
import pandas as pd
from statsmodels.tsa.arima_model import ARIMA
from typing import List
@seahrh
seahrh / data_description.md
Created June 15, 2020 01:06 — forked from jeremystan/data_description.md
The Instacart Online Grocery Shopping Dataset 2017 Data Descriptions

orders (3.4m rows, 206k users):

  • order_id: order identifier
  • user_id: customer identifier
  • eval_set: which evaluation set this order belongs in (see SET described below)
  • order_number: the order sequence number for this user (1 = first, n = nth)
  • order_dow: the day of the week the order was placed on
  • order_hour_of_day: the hour of the day the order was placed on
  • days_since_prior: days since the last order, capped at 30 (with NAs for order_number = 1)

products (50k rows):

@seahrh
seahrh / nric-validation.js
Created May 30, 2020 03:50 — forked from eddiemoore/nric-validation.js
Validation for Singapore NRIC and FIN number
//Based on http://www.samliew.com/icval/
function validateNRIC(str) {
if (str.length != 9)
return false;
str = str.toUpperCase();
var i,
icArray = [];
for(i = 0; i < 9; i++) {
i
me
my
myself
we
our
ours
ourselves
you
your
#
# stopwords.txt
#
# Freely available stopword list, balancing coverage and size.
#
# From http://www.lextek.com/manuals/onix/stopwords1.html
a
about
above
across