Skip to content

Instantly share code, notes, and snippets.

View kammitama5's full-sized avatar
🇹🇹
Research: Number Theory + Alg Graph Theory in Quantum / 😴. Also Lean learner

kammitama5

🇹🇹
Research: Number Theory + Alg Graph Theory in Quantum / 😴. Also Lean learner
View GitHub Profile
@Gabriella439
Gabriella439 / default.nix
Created January 7, 2022 16:14
Nix build of vscode with haskell-language-server
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz";
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq";
};
config = {
allowUnfree = true;
};
@Gabriella439
Gabriella439 / .stylish-haskell.yaml
Last active January 4, 2022 23:54
Files related to Haskell code formatting livestream
steps:
- module_header:
open_bracket: next_line
separate_lists: false
sort: false
- imports:
align: group
pad_module_names: false
long_list_align: new_line_multiline
separate_lists: false
@Gabriella439
Gabriella439 / Main.hs
Created September 2, 2021 00:56
Haskell livestream - Subprocess management
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent.Async (Concurrently(..))
import Data.Foldable (traverse_)
import Data.List.NonEmpty (NonEmpty(..))
import Data.Text (Text)
import Foreign.C
-- long brute force solution to exercise 7 on p. 20 of "Conceptual Mathematics"
-- if you don't have haskell on your computer, paste all this into:
-- https://replit.com/languages/haskell
-- this is how we define a data type in Haskell. think of it as a set
data Bit = Zero | One deriving (Show, Eq)
-- the last part tells Haskell to figure out how to print Bits, and that
-- Zero equals Zero, One equals One, and Zero is different from One
-- this is a type declaration. think domain and codomain
@Gabriella439
Gabriella439 / Main.hs
Created April 8, 2021 00:53
Example use of GHC generics to derive datatype parser
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyDataDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@Gabriella439
Gabriella439 / csv.hs
Created January 7, 2021 01:32
CSV decoding example
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
module Main where
import Data.Csv (FromField, FromNamedRecord)
import Data.Text (Text)
import Data.Map (Map)
let prologue =
{|
{-# language DeriveGeneric #-}
module Parser where
import Data.Csv
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import GHC.Generics
import Control.Monad
@gbaz
gbaz / Lambda.hs
Created August 6, 2020 00:41
type inference
module Lambda where
import qualified Data.Map as M
import Data.Maybe
import Control.Monad.State.Strict
import Debug.Trace
data Term = Lam String Term
| Var String
| App Term Term
| KonstInt Int
@Gabriella439
Gabriella439 / livestream.md
Created November 15, 2019 02:04
Awake Security Haskell Livestream

Awake Security Haskell Livestream

Who

Awake Security will be livestreaming a periodic 1-on-1 teaching session on Twitch. The subject of this session will always be one of our engineers teaching another one of our engineers how to do accomplish a practical task in Haskell while remote attendees watch, comment, and ask questions.

@patio11
patio11 / bitfinex-03152019.md
Created April 26, 2019 00:29
`shasum bitfinex-03152019.md` is 938d939059a23aa84ce493db0c4d542748f849a7

Prediction as of 3/15/2019 JST:

  • Bitfinex is insolvent, for the Bitcoin economy's usual quixotic definition of insolvent.
  • This happened as a result of collateralizing Tether with BTC and other cryptocurrencies during the run-up.
  • Bitfinex / Tether treat whether Bitfinex held the collateral or Tether held the collateral as a material distinction, but that's ridiculous due to common control. The important fact: in 2018, ground truth diverged from "There is $1 in a bank account for every tether outstanding" to "There is $1 in a bank account and/or $1 worth of Bitcoin at prevailing prices available to Bitfinex for every tether outstanding."
  • This makes Tether synthetically long Bitcoin, via a receivable from Bitfinex. Bitfinex took the newly issued Tether and then, since this accounting shellgame appears to balance its books and leave it with surplus Bitcoin, either sold or lent the Bitcoin to short sellers during the run-up.
  • If Bitfinex simply sold the Bitcoin, they're doing relatively well for themselve