Skip to content

Instantly share code, notes, and snippets.

import enumeratum.values.{IntEnum, IntEnumEntry}
import java.time.temporal.TemporalAdjusters
import java.time.{DayOfWeek, LocalDate, YearMonth}
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
object BankingDays {
def nextBankingDay(now: LocalDate, days: Int = 1): LocalDate = {
import java.time.temporal.TemporalAdjusters
import java.time.{DayOfWeek, LocalDate, YearMonth}
import scala.collection.mutable.ListBuffer
import enumeratum.values.{IntEnum, IntEnumEntry}
case class Holiday(name: String, date: LocalDate) {
val observed: LocalDate =
date.getDayOfWeek match {
case DayOfWeek.SATURDAY => date.minusDays(1)
case DayOfWeek.SUNDAY => date.plusDays(1)
@hmemcpy
hmemcpy / testcontainer.scala
Created July 8, 2020 10:49
ZIO layer for Postgres test container
import com.dimafeng.testcontainers.PostgreSQLContainer
import zio.blocking.{effectBlocking, Blocking}
import zio.{Has, ZLayer, ZManaged}
object TestContainer {
type Postgres = Has[PostgreSQLContainer]
def postgres(version: Option[String] = None): ZLayer[Blocking, Throwable, Postgres] =
ZManaged.make {
effectBlocking {
title date tags
test
2020-01-23 04:51:52 -0800

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar neque laoreet suspendisse interdum consectetur libero id. Nec feugiat nisl pretium fusce id velit ut tortor. Faucibus nisl tincidunt eget nullam. Dui id ornare arcu odio ut sem nulla pharetra. Praesent tristique magna sit amet purus gravida quis. Dictum sit amet justo donec enim diam vulputate ut. Velit aliquet sagittis id consectetur purus ut faucibus pulvinar elementum. Tortor at risus viverra adipiscing at in tellus. In iaculis nunc sed augue lacus viverra. Mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa eget. Consequat nisl vel pretium lectus quam. Adipiscing elit pellentesque habitant morbi tristique senectus et netus. Sapien faucibus et molestie ac feugiat sed lectus. Quam adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus urna. Eros donec ac odio tempor orci dapibus ultrices. Tincidunt tor

{ pkgs ? import <nixpkgs> {} }: with pkgs;
let
pygments24 = pythonPackages.pygments.overrideAttrs(old: rec {
version = "2.4.2";
src = pythonPackages.fetchPypi {
inherit version;
inherit (old) pname;
sha256 = "15v2sqm5g12bqa0c7wikfh9ck2nl97ayizy1hpqhmws5gqalq748";
};
@hmemcpy
hmemcpy / introduction6.groovy
Created October 3, 2018 13:44 — forked from peysal/introduction6.groovy
introduction to groovy 1) empty map 2) adding things to map 3) concat map to map 4) iterating
def emptyMap = [:]
assert emptyMap.size() == 0
def notEmptyMap = ["person1":"john", "person2":"mus"]
assert notEmptyMap.size() == 2
notEmptyMap.put "person3","test" //adding to existing one
assert notEmptyMap.size() == 3
notEmptyMap["person4"] = "beth"
assert notEmptyMap.size() == 4
\documentclass{article}
\usepackage{minted}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{libertine}
\defaultfontfeatures{
Scale=MatchLowercase,
}
\setmonofont[BoldFont={Inconsolata LGC Bold}]{Inconsolata LGC}
#!/bin/sh
# Shrinks the PDF by compressing images to JPEG using highest quality
# Original code from http://www.alfredklomp.com/programming/shrinkpdf/
# Modified with command taken from https://stackoverflow.com/questions/40849325/ghostscript-pdfwrite-specify-jpeg-quality
shrink ()
{
echo "Converting $IFILE > $OFILE"
@hmemcpy
hmemcpy / ramdisk.md
Last active November 18, 2024 17:26
RAMDisk benchmarks