Skip to content

Instantly share code, notes, and snippets.

View mtavkhelidze's full-sized avatar
🇬🇪
OOP is an exceptionally bad idea which could only have originated in California.

Misha Tavkhelidze mtavkhelidze

🇬🇪
OOP is an exceptionally bad idea which could only have originated in California.
View GitHub Profile
@mtavkhelidze
mtavkhelidze / build.sbt
Last active March 17, 2024 07:44
Dot build.sbt
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "3.4.0"
lazy val fpsCode = (project in file("."))
.settings(
name := "fps-code",
idePackagePrefix := Some("ge.zgharbi.study.fps"),
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.29" % Test,
@mtavkhelidze
mtavkhelidze / .scalafmt.conf
Last active March 17, 2024 07:42
Dot scalafmt.conf
align.preset = none
# From https://scalameta.org/scalafmt/docs/configuration.html
#
# Keep in mind that 80 characters fit perfectly on a split laptop
# screen with regular resolution.
#
# GitHub mobile view only shows 80 characters and sometimes you might
# review code on your phone.
#
# Consider refactoring your code before choosing a value above 100.
FROM alpine:3.10
ARG SPARK_VERSION=3.0.0-preview
ARG HADOOP_VERSION_SHORT=3.2
ARG HADOOP_VERSION=3.2.0
ARG AWS_SDK_VERSION=1.11.375
RUN apk add --no-cache bash openjdk8-jre python3
# Download and extract Spark
@mtavkhelidze
mtavkhelidze / match_case.py
Last active June 1, 2023 05:05
Scala-like case class pattern matching in Python >= 3.10
import math
from dataclasses import dataclass
from math import sqrt
"""
Scala-like case class pattern mathing in python >= 3.10
"""
@dataclass(frozen=True)
@mtavkhelidze
mtavkhelidze / MapReduce.scala
Created February 14, 2023 11:26 — forked from iravid/MapReduce.scala
Map-Reduce with ZIO
import $ivy.`dev.zio::zio:1.0.0-RC8-12`
import $ivy.`dev.zio::zio-streams:1.0.0-RC8-12`
import zio._, zio.stream._
object Step1 {
import java.nio.file.{Files, Paths, Path}
import scala.collection.JavaConverters._
import zio.blocking._
import matplotlib.pyplot as plt
import pandas as pd
from pandas import DataFrame
from pandas.io.common import urlopen
import numpy as np
URL = "https://covidtracking.com/api/v1/states/daily.json"
ALPHA = 0.1
LOGARITHMIC = False
@mtavkhelidze
mtavkhelidze / ru_veterans.py
Last active April 9, 2020 19:28
Number of veterans in Russia (blue) with annual change (red).
# Number of veterans in Russia
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.axes import Axes
from matplotlib.figure import Figure
raw_data_source = "https://twower.livejournal.com/2408991.html"
@mtavkhelidze
mtavkhelidze / vm.sh
Created October 31, 2019 10:36
Start/Stop VirtualBox VM in headless mode
#!/usr/bin/env bash
vmm=VBoxManage
function usage {
echo "Usage:" $(basename $0) "start|stop" "hostname" >/dev/stderr
}
function get_ip {
VBoxManage guestproperty enumerate $1 \
@mtavkhelidze
mtavkhelidze / range.js
Last active October 29, 2019 08:39
Some fun with lazy evaluation in JavaScript.
/**
* @constructor
*/
function* range(from, until) {
let i = from;
const stop = until ? i => i >= until : () => false;
while (true) {
if (!stop(i)) {
yield i;
} else {
@mtavkhelidze
mtavkhelidze / days-till
Last active October 26, 2019 11:45
Bash script to display number of days till a given date.
#!/usr/bin/env bash
till_date=$(echo $1 | tr -d "-")
echo ${till_date} | egrep -q "([0-9]){8,}"
(($? != 0)) && {
echo "Invalid date." 1>&2
echo "Usage: days-till YYYY-MM-DD" 1>&2