Skip to content

Instantly share code, notes, and snippets.

View lenguyenthanh's full-sized avatar
👻

Thanh Le lenguyenthanh

👻
View GitHub Profile
@lenguyenthanh
lenguyenthanh / logback.xml
Created July 16, 2024 07:34 — forked from arosien/logback.xml
scala-cli script to show inserting an otel4s span into a log4cats logger
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="CONSOLE"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%X{traceId} %X{spanId} - %m%n</Pattern>
</layout>
</appender>
// scalaVersion := "3.2.0"
// libraryDependencies ++= Seq(
// libraryDependencies ++= Seq(
// "org.typelevel" %% "cats-core" % "2.8.0",
// "dev.zio" %% "zio" % "2.0.0",
// "org.typelevel" %% "cats-effect" % "3.3.14",
// "org.typelevel" %% "kittens" % "3.0.0",
// "dev.zio" %% "zio-json" % "0.3.0-RC10",
// "io.d11" %% "zhttp" % "2.0.0-RC10"
// )
@lenguyenthanh
lenguyenthanh / analysis.draft.md
Created June 15, 2020 14:16 — forked from MattPD/analysis.draft.md
Program Analysis Resources (WIP draft)
@lenguyenthanh
lenguyenthanh / combinators.hs
Created September 14, 2019 08:51 — forked from Centril/combinators.hs
useful higher order combinators in haskell
(.$) :: (t -> b -> c) -> (a -> b) -> t -> a -> c
(.$) f g a = f a . g
infixr 8 .$
-- | '.|': Compose an unary function with a binary function.
-- from: http://hackage.haskell.org/package/pointless-fun-1.1.0.5/docs/Data-Function-Pointless.html
(.|) :: (b -> c) -> (t -> a -> b) -> t -> a -> c
(.|) f g a = f . g a
infixr 7 .|
@lenguyenthanh
lenguyenthanh / haskell-language-extensions.md
Created September 7, 2019 19:45 — forked from mightybyte/haskell-language-extensions.md
A Taxonomy of Haskell Language Extensions

Haskell Language Extension Taxonomy

Caveat: It's just personal opinion, and was written to be a bit provocative and encourage discussion . It is also something that is constantly evolving. Some of the main criteria I used in constructing this taxonomy are age, how widely used it us, and how well understood it is by the average Haskell programmer. These things will change over time.

Aso, this is focused on appropriateness for use in commercial production code bases. If you are not thinking about commercial use with a team of multiple

{-# OPTIONS_GHC -Wno-missing-methods #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module ThoughtLeaderTom where
import Control.Monad ((>=>))
@lenguyenthanh
lenguyenthanh / fx-test.kt
Created July 5, 2019 07:09 — forked from colomboe/fx-test.kt
Porting of "Simple example of testing with ZIO environment" to Kotlin
// Porting of https://gist.github.com/jdegoes/dd66656382247dc5b7228fb0f2cb97c8
typealias UserID = String
data class UserProfile(val name: String)
// The database module:
interface DatabaseService {
suspend fun dbLookup(id: UserID): UserProfile
suspend fun dbUpdate(id: UserID, profile: UserProfile)
}
@lenguyenthanh
lenguyenthanh / instructions.md
Created April 10, 2019 17:12 — forked from douglasmiranda/instructions.md
Add email to Keybase.io PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret &gt; keybase-private.key
@lenguyenthanh
lenguyenthanh / delete_git_submodule.md
Created December 1, 2018 17:29 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule