Skip to content

Instantly share code, notes, and snippets.

View notxcain's full-sized avatar
🏠
Working from home

Denis Mikhaylov notxcain

🏠
Working from home
View GitHub Profile
package data
import monocle.Lens
trait HasLens[A, B] {
def lens: Lens[A, B]
}
object HasLens extends HasLensSyntax0
@derekjw
derekjw / Fs2MapAsync.scala
Created April 23, 2018 10:08
ordered mapAsync for fs2
import cats.implicits._
import cats.effect.Effect
import fs2.{Pipe, Stream}
import fs2.async.Promise
import fs2.async.mutable.Queue
import scala.concurrent.ExecutionContext
def mapAsync[F[_]: Effect, A, B](parallelism: Int)(f: A => F[B])(implicit executionContext: ExecutionContext): Pipe[F, A, B] = { stream =>
Stream.eval(Queue.bounded[F, Option[F[Either[Throwable, B]]]](parallelism)).flatMap { q =>
@dannote
dannote / final-cut-pro-trial-reset.swift
Last active March 29, 2025 18:28
Final Cut Pro X trial reset
#!/usr/bin/swift
// DISCLAIMER
// This script modifies an unencrypted file associated with the trial version of Final Cut Pro.
// Under the DMCA (17 U.S.C. § 1201), this modification does not qualify as circumvention of a technological
// protection measure (TPM), as it does not involve bypassing encryption, authentication, or similar protections.
// Distributing this code is therefore legal under the DMCA.
// This script is intended for educational and research purposes, such as exploring trial-related file structures,
@chpatrick
chpatrick / typeable-reify
Last active September 2, 2017 07:53
Black magic and GADT serialization
# Black magic and GADT serialization
I thought it would be a cool exercise to write a simple but flexible RPC system in Haskell. The idea was that the server would have some functions and values available for you to use, and you can assemble them into a function call as you like, or provide your own parameters. In the end, writing the serialization and deserialization code ended up leading to some far more interesting challenges.
Some types, such as functions, cannot be serialized so they must be made available on the server. I represented this with the following GADT:
```haskell
type ValueID = Word32
type TypeID = Word32
@aras-p
aras-p / preprocessor_fun.h
Last active April 7, 2025 13:38
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 17, 2025 18:18
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶