Skip to content

Instantly share code, notes, and snippets.

@horothesun
horothesun / archlinux-qemu-kvm.md
Created December 7, 2025 13:32 — forked from tatumroaquin/archlinux-qemu-kvm.md
QEMU-KVM Installation for Arch Linux

QEMU-KVM in Arch Linux

Check Virtualization Support

lscpu | grep -i Virtualization
  • VT-x for Intel
  • AMD-Vi for AMD

Ensure that your kernel includes KVM modules

@horothesun
horothesun / Main.scala
Created August 31, 2025 00:21
TL2 STM experiments
//> using scala 3.7.2
//> using jvm temurin:21
//
//> using dep org.typelevel::cats-core:2.13.0
//> using dep org.typelevel::cats-effect:3.6.3
//
//> using test.dep org.scalameta::munit:1.1.1
//> using test.dep org.typelevel::munit-cats-effect:2.1.0
//> using test.dep org.scalameta::munit-scalacheck:1.1.0
//> using test.dep org.scalacheck::scalacheck:1.18.1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@horothesun
horothesun / Scala3CatsStmBankTransferExample.scala
Last active March 24, 2025 00:12
Scala 3 Cats STM bank transfer example
//> using scala 3.6.4
//> using jvm temurin:21
//
//> using dep org.typelevel::cats-core:2.13.0
//> using dep org.typelevel::cats-effect:3.6.0
//> using dep io.github.timwspence::cats-stm:0.13.5
import cats.syntax.all.*
import cats.effect.{IO, IOApp}
import io.github.timwspence.cats.stm.*
@horothesun
horothesun / scala-native.nix
Last active August 26, 2024 14:32
Scala Native Nix Flake
# Usage: nix-shell path/to/scala-native.nix
let
pkgs = import <nixpkgs> {};
pkgs-unstable = import <nixpkgs-unstable> {};
stdenv = pkgs.stdenv;
in rec {
clangEnv = stdenv.mkDerivation rec {
name = "clang-env";
shellHook = ''
@horothesun
horothesun / get_docker_hub_tags.sh
Last active June 29, 2023 13:00
Get Docker Hub repo tags
#!/bin/bash
# Call by running
# ./get_docker_hub_tags.sh "library" "alpine"
[[ -z "${DOCKER_HUB_TOKEN}" ]] && echo "Error: DOCKER_HUB_TOKEN must be defined" && exit 100
export DOCKER_NAMESPACE="$1"
export DOCKER_REPOSITORY="$2"
[[ -z "${DOCKER_NAMESPACE}" ]] && echo "Error: a Docker namespace must be passed as first argument" && exit 10
@horothesun
horothesun / get_all_gh_secrets.sh
Last active June 4, 2023 10:05
Get all GitHub secrets
#!/bin/bash
# Usage: ./get_all_gh_secrets.sh "<OWNER>" "100"
GITHUB_OWNER=$1
MAX_NUMBER_OF_REPOS=$2
[[ -z "${GITHUB_OWNER}" ]] && echo "Error: GITHUB_OWNER must be passed as first parameter" && exit 10
[[ -z "${MAX_NUMBER_OF_REPOS}" ]] && echo "Error: MAX_NUMBER_OF_REPOS must be passed as second parameter" && exit 20
@horothesun
horothesun / findNumber.pl
Created October 9, 2022 20:09
Find a number X such that "prepending" 4 to X equals to 4 times the number generated by "suffixing" X with 4
%% Find a number X such that "prepending" 4 to X equals to
%% 4 times the number generated by "suffixing" X with 4.
%%
%% X = X1,...,Xn . 4,X1,...,Xn = 4 * X1,...Xn,4
%%
%% :- find( 4, 9000, 11000, N ).
%%
natural( 0 ).
natural( s(X) ) :- natural( X ).
@horothesun
horothesun / input.csv
Created September 30, 2022 08:47
CSV filtering
user_id name phone
annoyingPrefix_001 Alice 07782123456
annoyingPrefix_002 Bob 07798765432
annoyingPrefix_003 Carl 07711928374
@horothesun
horothesun / CatsEffectOODecoratorCachedClient.scala
Last active June 16, 2022 21:04
Cats-effect - Cached client
import cats.effect.{IO, Resource}
case class Config()
case class InputA()
case class InputB()
case class InputC()
case class OutputA()
case class OutputB()
case class OutputC()