Skip to content

Instantly share code, notes, and snippets.

@Kirens
Kirens / procedure.md
Created January 13, 2018 14:27
Deploying a NixOS server on DigitalOcean

Prerequisites

We'll use NixOps to deploy, so we need to install it

nix-env -i nixops

And to deploy on DigitalOcean we need to have an account and create an API access token for it.

@lucasteles
lucasteles / monad.fsx
Last active November 1, 2022 23:16
option monad on fsharp
open System
//Helpers
let printOpt opt =
match opt with
|None -> printfn "None"
|Some v -> printfn "Some %s" v
// safe functions
let exclaimIt str = if str = "" then None else Some (str + "!")
@isaacabraham
isaacabraham / io-monad.fsx
Last active November 1, 2022 23:58
F# port of the first half of John De Goes "FP to the max" (https://www.youtube.com/watch?v=sxudIMiOo68)
#load @".paket\load\net452\FSharpPlus.fsx"
open FSharpPlus
open System
[<AutoOpen>]
module rec IO =
let run (IO computation) = computation()
type IO<'T> =
@System-Glitch
System-Glitch / generate_blocks.sh
Last active October 3, 2025 01:18
Tutorial for bitcoin regtest
# Script to generate a new block every minute
# Put this script at the root of your unpacked folder
#!/bin/bash
echo "Generating a block every minute. Press [CTRL+C] to stop.."
address=`./bin/bitcoin-cli getnewaddress`
while :
do
@swlaschin
swlaschin / effective-fsharp.md
Last active September 17, 2025 06:47
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

@SofianeHamlaoui
SofianeHamlaoui / brightness
Created February 1, 2020 12:38
brightness script
#!/usr/bin/env bash
set -e
get_display_info() {
xrandr --verbose | grep -w "$1 connected" -A8 | grep "$2" | cut -f2- -d: | tr -d ' '
}
# cribbed from redshift, https://github.com/jonls/redshift/blob/master/README-colorramp
GAMMA_VALS=('1.0:0.7:0.4' # 3000K
'1.0:0.7:0.5' # 3500K
@jdavid82
jdavid82 / .vimrc
Last active December 2, 2024 09:40
vim settings for full stack C# development in Windows 10
"Allow project specific .vimrc execution
set exrc
"no backup files
set nobackup
"only in case you don't want a backup file while editing
set nowritebackup
"no swap files
@Horusiath
Horusiath / Effect.fs
Created September 19, 2020 04:58
Inferred dependency injection over async bindings.
open System
[<Struct>] type Effect<'env, 'out> = Effect of ('env -> Async<'out>)
[<RequireQualifiedAccess>]
module Effect =
/// Create value with no dependency requirements.
let inline value (x: 'out): Effect<'env,'out> = Effect (fun _ -> async.Return x)
/// Create value which uses depenendency.
@Kixunil
Kixunil / efficient_reusable_taproot_addresses.md
Last active January 19, 2025 17:09
Efficient reusable Taproot addresses

Reusable taproot addresses

Abstract

This document proposes a new scheme to avoid address reuse while retaining some of the convenience of address reuse, keeping recoverability purely from Bitcoin time chain and avoiding visible fingerprint. The scheme has negligible average overhead.

Motivation