Skip to content

Instantly share code, notes, and snippets.

View romac's full-sized avatar
🔮
λ

Romain Ruetschi romac

🔮
λ
View GitHub Profile
@sainoe
sainoe / local-testnet-permissionless-equivocation.sh
Last active September 20, 2024 08:02
ICS Permissionless testnet
#!/bin/bash
set -eux
## Prerequisites:
# * ICS v6.x
# * Hermes v1.10.3+45a29cc00
# User balance of stake tokens
USER_COINS="100000000000stake"
# Amount of stake tokens staked
@kubukoz
kubukoz / .scalafmt.conf
Last active September 14, 2024 04:45
How to disable significant indentation in Scala
runner.dialect = scala3
runner.dialectOverride.allowSignificantIndentation = false
# allows `if x then y`
runner.dialectOverride.allowQuietSyntax = true
@heaths
heaths / workspace-dependencies.rs
Last active February 27, 2024 09:27
Rust script to verify that package dependencies are inherited from single workspace.
#!/usr/bin/env -S cargo +nightly -Zscript
---
[package]
edition = "2021"
[dependencies]
cargo-util-schemas = "0.1.0"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
toml = "0.8.10"
@gelisam
gelisam / MutuCheckInfer.hs
Last active September 4, 2024 21:32
A recursion scheme for mutually-recursive types
-- Defining a custom recursion scheme to manipulate two mutually-recursive
-- types, in the context of a toy bidirectional type checker.
{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving, ScopedTypeVariables #-}
module Main where
import Test.DocTest
import Control.Monad (when)
import Data.Bifunctor (Bifunctor(bimap))
import Data.Bifoldable (Bifoldable(bifoldMap), bitraverse_)
@sainoe
sainoe / change_voting_period
Last active October 17, 2022 15:59
testnet-scripts
#!/bin/bash
set -eux
```
tee ${PROV_NODE_DIR}/change-voting-period.json<<EOF
{
"title": "Change voting period",
"description": "Voting period",
"changes": [
@HipHopHuman
HipHopHuman / incremental-game-loop.md
Last active September 19, 2024 10:04
How to make a game loop for your idle game

How do I make a game loop for my Idle Game?

Interval-Based Resource Generators

So, you want to build an idle/incremental game in JavaScript and you’ve read on the internet that setInterval is the way to go when it comes to handling resources that automatically generate over time.

You get started, you write down your setInterval function, you set it to trigger once every 1000 milliseconds, and every time it triggers, you add 1 to the player’s total resource count. Perfect. It works.

Uh-oh.

@piperswe
piperswe / build_push_and_run.sh
Created April 17, 2021 01:53
Build multi-architecture Docker images with Nix
#!/bin/sh
# Required on macOS because cctools is marked as broken
export NIXPKGS_ALLOW_BROKEN=1
nix run -f image.nix -c push
docker run ghcr.io/piperswe/hello
@SergeiMeza
SergeiMeza / macOS_ChatApp_Main.swift
Last active June 21, 2023 09:31
Chat App Client (UI) for macOS in SwiftUI
// Main
@main
struct ChatApp_macOSApp: App {
var body: some Scene {
WindowGroup {
Home()
}
// Hiding Title Bar...
.windowStyle(HiddenTitleBarWindowStyle())
@tomslominski
tomslominski / avahi-alias.sh
Last active September 3, 2024 12:05
Avahi alias systemd service. The first file is the script to be run, which you can store in your home directory. The second file is the systemd unit file which goes in /etc/systemd/system. Make sure on line 6 it references the location of the first file, and that you run systemctl daemon-reload after editing the unit file.
#!/bin/bash
local=$(avahi-resolve -4 -n $(hostname).local | cut -f 2)
hostname=$1
if [ $local != "127.0.0.1" ]
then
echo "Aliasing $local as $hostname."
avahi-publish -a -R $hostname $local
else
@romac
romac / README.md
Last active June 19, 2020 10:20
Switch between iTerm profiles based on the active macOS theme