Skip to content

Instantly share code, notes, and snippets.

View therealcisse's full-sized avatar

Amadou Cisse therealcisse

View GitHub Profile
@therealcisse
therealcisse / ImmutableLRU.scala
Created October 7, 2021 12:19 — forked from Daenyth/ImmutableLRU.scala
LruRef / LRU for cats-effect
package teikametrics
import scala.collection.SortedMap
/**
* Immutable implementation of an LRU cache.
*
* @author Twitter
*
* Copy pasted from the version previously in twitter-util v19.1.0 at
// comparing to kotlin version: https://proandroiddev.com/extension-classes-f9dcf5878b71
sealed trait Feature
object SomeFeature extends Feature
trait AppFeatures {
def isEnabled(feature: Feature): Boolean
}
extension (appFeatures: AppFeatures) {
@therealcisse
therealcisse / scala_debugging_tricks.md
Created October 5, 2018 00:23 — forked from bbarker/scala_debugging_tricks.md
SBT and JVM Debugging tricks

IntelliJ and recursive data structures

You may need to override toString on any recursive or deeply-nested data structure, since IntelliJ will ask the Java Debugger (JDB) to call toString all the time. This will blow up your memory.

Remote debugging

Useful for any number of reasons: testing on a different OS, using lots of memory/cpu resources you don't have locally, etc.

See an Intellij / IDEA guide for background.

@therealcisse
therealcisse / GuessTheNumber.scala
Created October 4, 2018 21:43 — forked from weihsiu/GuessTheNumber.scala
Example of using Eff monad
package catssandbox
import aiyou._
import aiyou.implicits._
import cats._
import cats.data._
import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._
import IOEffect._
@therealcisse
therealcisse / instructions.txt
Created September 4, 2018 16:25 — forked from nathanborror/instructions.txt
Example Kubernetes setup with Postgres and two Services for serving an API and a static site using Ingress. Also have a CronJob example for kicks.
*** Cluster Setup for Google Container Engine ***
0/ Install and configure local gcloud and kubectl: https://cloud.google.com/sdk/docs/
> gcloud components install kubectl
1/ Configure Google Cloud account:
> gcloud config set account YOUR_EMAIL_ADDRESS
> gcloud config set project YOUR_PROJECT_ID
> gcloud config set compute/zone us-west1-a
> gcloud config set container/cluster example
@therealcisse
therealcisse / isBusinessDay.java
Created August 13, 2018 07:10 — forked from greyaperez/isBusinessDay.java
Function to Check Whether Date is a Business Day or Not (ex: Weekend or Holiday)
/**
* Is Date A Business Day?
* @param cal
* @return boolean
*/
public boolean isBusinessDay(Calendar cal){
// check if weekend
if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){
return false;
}

Restoo

Restaurant stock management app.

Getting started

Database

I'm using an in-memory h2 database. The database will be automatically created via a migration using Flyway

@therealcisse
therealcisse / README.md
Created July 11, 2018 00:58 — forked from pathikrit/README.md
My highly opinionated list of things needed to build an app in Scala
@therealcisse
therealcisse / TestMultipartFileUpload.scala
Created January 16, 2018 21:59 — forked from jrudolph/TestMultipartFileUpload.scala
akka-http Multipart file-upload client + server example
package akka.http.scaladsl
import java.io.File
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.util.ByteString
import scala.concurrent.duration._
import akka.actor.ActorSystem
@therealcisse
therealcisse / carbon-cache@i.service
Created March 8, 2017 00:27 — forked from joemiller/carbon-cache@i.service
leveraging systemd instantiated units for graphite carbon-cache instances
[Unit]
Description=carbon-cache instance %i (graphite)
[Service]
User=graphite
Group=graphite
ExecStartPre=/bin/rm -f /opt/graphite/storage/carbon-cache-%i.pid
ExecStart=/opt/graphite/bin/carbon-cache.py --instance=%i start
Type=forking
PIDFile=/opt/graphite/storage/carbon-cache-%i.pid