Skip to content

Instantly share code, notes, and snippets.

View fancellu's full-sized avatar

Dino Fancellu fancellu

View GitHub Profile
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active April 23, 2024 15:35
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@zeljic
zeljic / build_sqlite3_lib.md
Last active April 10, 2024 09:19
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source

    For example: source https://www.sqlite.org/2023/sqlite-amalgamation-3430100.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2023/sqlite-dll-win64-x64-3430100.zip

  3. Extract both archives to the same directory

@KexinFeng
KexinFeng / BertTranslator.java
Last active January 4, 2024 08:41
Deploying HuggingFace QA model in Java
import ai.djl.modality.nlp.DefaultVocabulary;
import ai.djl.modality.nlp.Vocabulary;
import ai.djl.modality.nlp.bert.BertToken;
import ai.djl.modality.nlp.bert.BertTokenizer;
import ai.djl.modality.nlp.qa.QAInput;
import ai.djl.ndarray.NDArray;
import ai.djl.ndarray.NDList;
import ai.djl.ndarray.NDManager;
import ai.djl.translate.Batchifier;
import ai.djl.translate.Translator;
@fancellu
fancellu / .block
Last active August 3, 2023 01:59
Force directed graph for D3.js v4 with labelled edges and arrows
license: gpl-3.0
height: 600
@eduncan911
eduncan911 / Revert-Gist.md
Last active July 20, 2023 09:41
Revert Gist Commits

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone git@github.com:cc13e0fcf2c348cc126f918e4a3917eb.git

Treat it like a normal repo. Edit, force push, etc.

@zhenwenc
zhenwenc / DoobieSyntax.scala
Last active July 17, 2023 19:55
Doobie ConnectionIO helpers for use with Quill integration
import doobie._
import doobie.implicits._
import cats.data.NonEmptyList
import cats.implicits._
sealed abstract class UnexpectedResultSetSize(msg: String) extends Exception(msg)
final case object UnexpectedOptionalContinuation
extends UnexpectedResultSetSize(s"Expected ResultSet with zero or one row, but more rows were available.")
@Swoorup
Swoorup / ActorK.scala
Last active July 17, 2023 19:54
Typed Actors using Cats Effect, FS2 and Deferred Magic
import cats.effect.syntax.all.*
import cats.syntax.all.*
import cats.effect.*
import fs2.Stream
import cats.effect.std.Queue
import scala.concurrent.duration.*
import lib.FSM
import lib.actor.{Actor, AskMsg}
@jboner
jboner / how-akka-maps-to-eai-patterns.txt
Last active October 9, 2022 21:57
How Akka maps to EAI Patterns
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html
@jboner
jboner / PersistedGameOfPingPong.scala
Last active March 27, 2019 16:43
A game of ping pong using two Akka Actors, persisted using Event Sourcing through Akka Persistence
package demo
import akka.actor.{Props, ActorSystem}
import akka.persistence.PersistentActor
object PingPong extends App {
case object Ball // The Command
case object BallReceived // The Domain Event, represents a Fact, something that have already happened
class Ping extends PersistentActor {
@jboner
jboner / GameOfPingPong.scala
Last active March 27, 2019 16:43
A game of ping pong using Akka Actors. For a version that is persisted using Event-Sourcing see this gist: https://gist.github.com/jboner/9990435
package demo
import akka.actor.{Actor, Props, ActorSystem}
object PingPong extends App {
case object Ball
class Ping extends Actor {
var counter = 0