Skip to content

Instantly share code, notes, and snippets.

View chessai's full-sized avatar

chessai chessai

View GitHub Profile
@aljce
aljce / Pokemon.hs
Last active April 13, 2018 23:26
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeInType #-}
module Pokemon where
import Data.Kind (Type)
import Data.Void (Void)
import Type.Reflection ((:~:)(..))

Ideas to improve my workflow

Easy

diff-factor-comments

A script that automatically separates a Haskell file diff into two diffs: one with only changes to comments, and one with changes to actual code.

Could be extended to other languages, as long as you can describe what the

Things to keep in mind

  • If you write a server using raw UDP, the size of a packet returned as a result of a packet received must be strictly smaller than the size of the packet received, to prevent DoS amplification attacks.
@mpickering
mpickering / Instructions.md
Last active August 11, 2018 09:42
Using head.hackage

How to test your package with ghc-8.6.1

  1. Setup the binary cache -
cachix use mpickering

For only GHC

@taktoa
taktoa / haskell-pain-points.md
Last active October 26, 2019 04:18
A rant about pain points in Haskell, written as a response to https://redd.it/7rwuxb

I started writing this polemic to answer your question, but I ended up touching on most of my gripes with Haskell in general, not just in a corporate context.

GHC

GHC is a modern compiler with an amazing RTS and tons of features, but I have some issues with it.

Monolithic and Hard to Contribute To

@andrewthad
andrewthad / zookeeper_protocol_notes.md
Created July 7, 2019 12:37
Zookeeper Protocol Notes

Discerning the Zookeeper Protocol

To write a zookeeper client, it is neccessary to understand the protocol used to communicate with it. Unfortunately, this protocol is not documented. In this example, we use tcpflow to dump both the read and write channel of the TCP connection that zkCli.sh uses to connect with the zookeeper server.

Requests

{-# LANGUAGE StandaloneDeriving, FlexibleContexts, UndecidableInstances #-}
-- Laungh ghci with -fobject-code to make the Fix/Tree trick work (thanks edwardk).
-- courtesy of hpc on #haskell
import Unsafe.Coerce
import Control.Monad.ST
toInteger :: Int -> Integer
isJust :: Maybe a -> Bool
null :: [a] -> Bool
@masaeedu
masaeedu / init-haskell.sh
Last active May 20, 2021 15:24
Basic nix haskell setup
#!/usr/bin/env bash
set -Eeuxo pipefail
# Set up git
git init
gitignore haskell
echo '*.cabal' >> .gitignore
# Set up niv
niv init
@Manouchehri
Manouchehri / windows10qemu.sh
Last active February 10, 2022 18:50
Running Windows 10 in a UEFI enabled QEMU environment with KVM.
# Installing
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 2048 -cdrom ~/Downloads/Win10_English_x64.iso -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -drive file=~/Downloads/virtio-win-0.1.105.iso,index=1,media=cdrom
# Running
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 4096 -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -usbdevice tablet -rtc base=utc
@Gabriella439
Gabriella439 / fibonacci.hs
Created March 25, 2018 00:52
Efficient fibonacci numbers using infinite precision integer arithmetic
import Numeric.Natural (Natural)
import qualified Data.Semigroup
-- | @fibonacci n@ computes the @nth@ fibonacci number efficiently using infinite
-- precision integer arithmetic
--
-- Try @fibonacci 1000000@
fibonacci :: Natural -> Natural
fibonacci n = x01 (Data.Semigroup.mtimesDefault n m)