View shell.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> {}; | |
rubyEnv = pkgs.ruby_3_2.withPackages(p: with p; [ | |
pry | |
nokogiri | |
]); | |
in with pkgs; | |
mkShell { |
View GameService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.pinkstack.tttx | |
package mk2.services | |
import mk2.services.Protocol.Connected | |
import cats.* | |
import cats.effect.* | |
import cats.effect.std.Queue | |
import cats.syntax.all.* | |
import fs2.Stream |
View i-love-ps.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Oto Brglez - <otobrglez@gmail.com> | |
$folderPath = "dodo-was-here" | Resolve-Path | |
Get-ChildItem -Path $folderPath -Recurse -File | | |
ForEach-Object { | |
$newName = Join-Path (Split-Path $_.FullName) ` | |
-ChildPath ($_.FullName -replace $folderPath,'' -replace '/|\\','-' -replace '^(.)','') | |
Rename-Item -Path $_.FullName -NewName $newName -Force # -WhatIf | |
} |
View DelayedTaskApp.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Oto Brglez - <otobrglez@gmail.com> | |
import net.greghaines.jesque.client.{Client as JesqueClient, ClientImpl} | |
import net.greghaines.jesque.worker.{JobFactory, MapBasedJobFactory, WorkerImpl} | |
import net.greghaines.jesque.{Config as JesqueConfig, ConfigBuilder, Job as JesqueJob} | |
import zio.* | |
import zio.Clock.currentTime | |
import zio.Console.printLine | |
import zio.ZIO.{acquireRelease, attempt, blocking, fail, logDebug, logError, logInfo, service, succeed} | |
import zio.stream.ZStream.fromQueue |
View out.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Projects/compression-puzzle feature/red-language ● nix-env -iA nixpkgs.red | |
installing 'red-0.6.4' | |
error: Package ‘red-0.6.4’ in /nix/store/02jzg4iiafapgb2p77aspm6ama87qp5y-nixpkgs-22.05pre338661.3c52ea8c921/nixpkgs/pkgs/development/interpreters/red/default.nix:81 is not supported on ‘x86_64-darwin’, refusing to evaluate. | |
a) To temporarily allow packages that are unsupported for this system, you can use an environment variable | |
for a single invocation of the nix tools. | |
$ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 | |
b) For `nixos-rebuild` you can set |
View puzzle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
const sequence = (string) => string.split(/(?<=(.))(?!\1|$)/g) | |
.filter((_, i) => !(i % 2)) | |
.map((c) => [c.length, c[0]]) | |
.flatMap((c) => c) | |
.join('') | |
assert.equal(sequence("AAABBAAC"),"3A2B2A1C") |
View changeswithkey.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID | |
sealed trait Change[V] extends Product { val value: V } | |
final case class Added[V](value: V) extends Change[V] | |
final case class Updated[V](value: V, prev: V) extends Change[V] | |
def changesWithKey[T, K](previous: Array[T], current: Array[T]) | |
(implicit key: T => K): Array[Change[T]] = { | |
val updates: Array[Change[T]] = for { | |
p <- previous; c <- current |
View Main.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.pollpass.experimental | |
import cats.data.ValidatedNec | |
object Example1 { | |
def run(): Unit = { | |
type Checker = Char => Boolean | |
val isBraille: Checker = _ => false |
View SimpleCache.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final case class SimpleCache() { | |
private def tempDir(key: String): IO[Path] = | |
IO.fromTry(Try(System.getProperty("java.io.tmpdir")).map(s => Paths.get(s, key))) | |
private def serialize[V](path: Path)(v: V): Unit = { | |
val out = new ObjectOutputStream(new FileOutputStream(path.toString)) | |
out.writeObject(v) | |
out.close() | |
} |
View Server2.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.server.Directives._ | |
import cats.effect.{IO, IOApp, Resource} | |
import cats.syntax.all.catsSyntaxMonadErrorRethrow | |
import ch.megard.akka.http.cors.scaladsl.CorsDirectives.cors | |
import com.google.cloud.texttospeech.v1.TextToSpeechClient | |
import com.typesafe.scalalogging.LazyLogging | |
object Boot extends IOApp.Simple with LazyLogging { |
NewerOlder