Skip to content

Instantly share code, notes, and snippets.

View Masynchin's full-sized avatar

Max Smirnov Masynchin

View GitHub Profile
@MichaelCurrin
MichaelCurrin / README.md
Last active April 6, 2025 18:23
GitHub GraphQL - Get files in a repository

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query

@taig
taig / load-image.scala
Last active October 13, 2025 20:36
Scala.js image loading with cats Deferred
import cats.effect.concurrent.Deferred
import cats.effect.implicits._
import cats.effect.{ConcurrentEffect, IO}
import cats.implicits._
import org.scalajs.dom.html.Image
import org.scalajs.dom.{document, Event}
def loadImage[F[_]](url: String)(implicit F: ConcurrentEffect[F]): F[Boolean] =
for {
promise <- Deferred[F, Boolean]
@reegnz
reegnz / README.md
Last active November 12, 2025 20:57
Implementing a jq REPL with fzf

Implementing a jq REPL with fzf

Update: I created jq-zsh-plugin that does this.

One of my favourite tools of my trade is jq. It essentially enables you to process json streams with the same power that sed, awk and grep provide you with for editing line-based formats (csv, tsv, etc.).

Another one of my favourite tools is fzf.

@Daenyth
Daenyth / KeyedEnqueue.scala
Created October 9, 2019 14:22
fs2 groupBy / KeyedEnqueue
import cats.Monad
import cats.effect.concurrent.{Ref, Semaphore}
import cats.effect.{Concurrent, Resource}
import cats.implicits._
import fs2.{Pipe, Stream}
import fs2.concurrent.{NoneTerminatedQueue, Queue}
/** Represents the ability to enqueue keyed items into a stream of queues that emits homogenous keyed streams.
*
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@friedbrice
friedbrice / BeginnerArgs.hs
Last active July 28, 2023 10:26
Haskell Command-line Arguments (scroll down for prose).
import System.Environment (getArgs)
myApp :: [String] -> IO ()
myApp args =
case args of
[name] -> putStrLn ("Top of the morning to you, " ++ name)
_ -> putStrLn "I only know how to use one argument D:"
main :: IO ()
main = do
@SegFaultAX
SegFaultAX / io.py
Created December 18, 2018 03:03
Simple IO monad [Python]
#!/usr/bin/env python
import functools
import typing as ty
from dataclasses import dataclass
A = ty.TypeVar("A")
B = ty.TypeVar("B")
@SegFaultAX
SegFaultAX / free.py
Created December 17, 2018 08:48
Simple Free Monad [Python]
import dataclasses as dc
import typing as ty
import inspect
import functools
S = ty.TypeVar("S")
A = ty.TypeVar("A")
B = ty.TypeVar("B")
@dc.dataclass(frozen=True)
@dsebban
dsebban / fs2-pull.md
Last active January 3, 2025 04:14
Understanding fs2 `Pull`

Undertsanding the Pull type from fs2

From the scaladocs

class Stream[+F[_], +O] extends AnyVal
  • A stream producing output of type O
  • May evaluate F effects.
@fschutt
fschutt / Rust.sublime-color-scheme
Created June 15, 2018 16:17
Rust Sublime Color Scheme
{
"name": "Rust color scheme",
"rules": [
/* --- grey items --- */
{
"scope": "comment",
"foreground": "color(var(black) blend(#fff 50%))",
},
/* --- red items --- */
{