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
# https://gist.github.com/pwm/1380feaa134ec7f7d99d8b34a07908ad | |
# | |
# Copy this file into the root dir of the project and run `nix-shell` | |
# | |
{ compiler ? "ghc948" }: | |
let | |
pkgs = import | |
(builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/f8e2ebd66d097614d51a56a755450d4ae1632df1.tar.gz"; | |
sha256 = "03cxv9h218dj7kc5hb0yrclshgbq20plyrvnfdaw5payyy9gbsfr"; |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
cd "$(git rev-parse --show-toplevel)" | |
if [[ "$(uname)" == "Linux" ]]; then | |
my_cores=$(nproc) | |
elif [[ "$(uname)" == "Darwin" ]]; then | |
my_cores=$(sysctl -n hw.ncpu) | |
else | |
echo "Unknown number of cores ¯\_(ツ)_/¯" |
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
-- Solving Fix / Mu / Nu exercise in | |
-- https://stackoverflow.com/questions/45580858/what-is-the-difference-between-fix-mu-and-nu-in-ed-kmetts-recursion-scheme-pac | |
{-# LANGUAGE RankNTypes, GADTs #-} | |
---------------------------------------- | |
-- Fix / Mu / Nu | |
newtype Fix f = Fix { unFix :: f (Fix f) } |
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
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
module BFS where | |
import Control.Applicative | |
import Control.Monad.Logic | |
import Control.Monad.Reader |
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
~/w/haskell-language-server (master|…) $ cat notes.txt | |
mkdir -p /Users/$USER/.cabal/bin/8107 | |
git clone https://github.com/haskell/haskell-language-server.git | |
cd haskell-language-server | |
cachix use haskell-language-server | |
nix-shell --argstr compiler ghc8107 | |
cabal update && cabal build | |
cabal install --overwrite-policy=always --installdir=/Users/$USER/.cabal/bin/8107 |
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
#!/usr/bin/env nix-shell | |
#!nix-shell -i bash -p ffmpeg pngquant gifski gifsicle | |
# shellcheck shell=bash | |
set -euo pipefail | |
if [[ "$#" -ne 3 ]]; then | |
echo "Usage: gif.sh <name> <scale> <fps>" | |
exit 1 | |
fi |
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
#!/usr/bin/env nix-shell | |
#!nix-shell -i bash -p ffmpeg pngquant gifski gifsicle | |
# shellcheck shell=bash | |
set -euo pipefail | |
if [[ "$#" -ne 3 ]]; then | |
echo "Usage: gif.sh <name> <scale> <fps>" | |
exit 1 | |
fi |
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
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DerivingStrategies #-} | |
{-# LANGUAGE OverloadedLabels #-} | |
module A where | |
import Control.Lens | |
import Data.Generics.Labels () | |
import GHC.Generics (Generic) | |
import Prelude |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
function getBatchInfo() { | |
batch=$(sudo su - pool -c "pool auction s ${1:-""}") | |
batch_id=$(echo "$batch" | jq -r '.batch_id') | |
prev_batch_id=$(echo "$batch" | jq -r '.prev_batch_id') | |
batch_tx_id=$(echo "$batch" | jq -r '.batch_tx_id') | |
asks=$(echo "$batch" | jq -r '[.matched_orders[].ask.rate_fixed] | max') |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
cd "$(dirname "${BASH_SOURCE[0]}")" | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: gisto.sh <user>" | |
exit 1 | |
fi |
NewerOlder