Skip to content

Instantly share code, notes, and snippets.

@varokas
varokas / docker-compose.yml
Created March 24, 2020 06:03
Jupyter in Docker
version: '3'
services:
jupyter:
image: jupyter/scipy-notebook:latest
ports:
- "8888:8888"
- "4040:4040"
volumes:
- .:/home/jovyan
environment:
@varokas
varokas / Handler.java
Created March 18, 2020 05:23
Java Lambda
package com.serverless;
import java.util.Collections;
import java.util.Map;
import org.apache.log4j.Logger;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
@varokas
varokas / summary.py
Created February 25, 2020 14:38
summary.py
#%%
from collections import Counter
with open("test.txt") as f:
txt = f.read()
start = txt.find("------") + 7
line_items = txt[start:].split("\n")
items = [x for x in line_items if x.startswith("-")]
@varokas
varokas / ynab_csv.py
Created February 2, 2020 07:20
ynab_csv.py
import argparse
import os
import csv
from collections import namedtuple
apple_card_header = "Transaction Date,Clearing Date,Description,Merchant,Category,Type,Amount (USD)".split(",")
def apple_card_transform(row):
outflow = row[6] if row[5] == "Purchase" else None
inflow = row[6][1:] if row[5] == "Payment" else None
@varokas
varokas / annual_returns.ipynb
Last active December 18, 2019 20:49
annual_returns.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
@varokas
varokas / all.html
Last active May 21, 2019 01:48
Thai Professional Day 2019 Questions
<div class="questions-main-panel__list questions-main-panel__list--no-top-border" in-viewport=""><!----><div class="stretch-y ng-star-inserted"><!----><admin-event-questions-item class="ng-star-inserted"><div class="eq-item stretch-x"><div class="eq-item__header flex items-center flex-between"><div class="flex items-center"><!----><!----><admin-user-avatar class="eq-item__header-avatar ng-star-inserted"><div class="l-mr1 stretch-y stretch-x"><div class="flex flex-center flex-x-center stretch-y"><!----><!----><div class="ng-star-inserted"><svg-icon class="icon-size20 block"><g><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"></path></svg></g></svg-icon></div><!----></div></div></admin-user-avatar><div><div class="eq-item-header__text">Anonymous</div><div class="eq-item-header__sub-text"><!----><span class="eq-item-header__score ng-star-inserted">2<svg-icon class="icon-size12 f-medi
@varokas
varokas / HTML
Created May 21, 2019 01:46
Thai Professional Day 2019 Questions
<div class="questions-main-panel__list questions-main-panel__list--no-top-border" in-viewport=""><!----><div class="stretch-y ng-star-inserted"><!----><admin-event-questions-item class="ng-star-inserted"><div class="eq-item stretch-x"><div class="eq-item__header flex items-center flex-between"><div class="flex items-center"><!----><!----><admin-user-avatar class="eq-item__header-avatar ng-star-inserted"><div class="l-mr1 stretch-y stretch-x"><div class="flex flex-center flex-x-center stretch-y"><!----><!----><div class="ng-star-inserted"><svg-icon class="icon-size20 block"><g><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"></path></svg></g></svg-icon></div><!----></div></div></admin-user-avatar><div><div class="eq-item-header__text">Anonymous</div><div class="eq-item-header__sub-text"><!----><span class="eq-item-header__score ng-star-inserted">2<svg-icon class="icon-size12 f-medi
(ns clojure-kata.prime)
(defn divisible [x y] (zero? (mod x y)))
(defn is-prime
([primes-before n] (not-any? (partial divisible n) primes-before)))
(defn next-prime
([primes-before n] (first (filter (partial is-prime primes-before) (iterate inc n)))))
@varokas
varokas / Dockerfile
Last active October 4, 2018 05:20
scikit
FROM python:3.7
WORKDIR /usr/src
RUN pip install scikit-learn==0.20.0 pandas==0.23.4
COPY learn.py ./
COPY run.sh ./
CMD ["./run.sh"]