Skip to content

Instantly share code, notes, and snippets.

View vgamula's full-sized avatar

Volodymyr Gamula vgamula

View GitHub Profile
import csv
import os
from decimal import Decimal
total_sum = Decimal(0)
for file_name in os.listdir("."):
if not file_name.endswith('.csv'):
continue
@vgamula
vgamula / lambada.py
Last active March 3, 2021 18:47
Persistent List and Persistent Queue written in Python
def make_pair(a, b):
def _tmp(f):
return f(a, b)
return _tmp
def make_list():
return ()
def is_empty(p):
return p == ()
@vgamula
vgamula / keybase.md
Created July 23, 2019 08:29
keybase.md

Keybase proof

I hereby claim:

  • I am vgamula on github.
  • I am vgamula (https://keybase.io/vgamula) on keybase.
  • I have a public key ASDltf9d5eS1I7251I68lrQmwuaN0UXfG0G56AFuOgpjHAo

To claim this, I am signing this object:

@vgamula
vgamula / lru_cache.py
Created September 2, 2018 17:49
LRU Cache Implementation
class Node:
def __init__(self):
self.key = None
self.value = None
self.left = None
self.right = None
class LRUCache:
def __init__(self, size):
@vgamula
vgamula / gist:5059026f94335e8b648a
Last active November 9, 2017 09:34
JS implementation of `match` functions which supports `?` and `*`
function match(str, pattern) {
if (!pattern || pattern === '*') {
return true;
}
var strIndex = 0;
for (var i = 0; i < pattern.length; ++i) {
if (pattern[i] === '*') {
if ((i + 1) < pattern.length) {
var nextChar = pattern[i + 1];
var restOfStr = str.slice(strIndex);