Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
Staring

Julian Ospald hasufell

👀
Staring
View GitHub Profile
@hasufell
hasufell / github.md
Last active Oct 18, 2022
Migrating tooling to github / providing github action runners to Haskell infrastructure
View github.md

Migrating tooling to github / providing github action runners to Haskell infrastructure

Current state

  1. GHCup relies on Gitlab CI for testing and releases
  2. GHCup maintainers also use Gitlab CI to build darwin M1 stack binaries
  3. HLS and Cabal rely on Gitlab CI for releases only
  4. projects like bytestring rely on very slow emulation on github actions or other semi-private runners

The problem

View gist:c230564d5b730b47ee423816b70c4001
mapKey <e:v> j
mapKey <o:v> k
mapKey <n:v> h
mapKey <i:v> l
mapKey <h:v> e
mapKey <c-c> <c-[>
# Insert your preferred key mappings here.
View gist:35898962417a6be0f2ef45e8f274de8e
package haskell-language-server
flags: -floskell -fourmolu -ormolu -stylishHaskell -changeTypeSignature -gadt -selectionRange -alternateNumberFormat -splice -moduleName -tactic -retrie -rename -importLens -eval -class
@hasufell
hasufell / correctness.md
Last active Jun 24, 2022
AFPP and correctness
View correctness.md

Correctness issues with current String based filepath handling

Context

On unix, the base library uses getFileSystemEncoding and mkTextEncoding to pick a round-trippable encoding for filepaths. E.g. if your locale returns en_US.UTF-8 you'll get UTF-8//ROUNDTRIP TextEncoding, which is based on PEP 383.

@hasufell
hasufell / Playground.hs
Last active Nov 28, 2021
Plutus Playground Smart Contract
View Playground.hs
import Control.Monad (void)
import Data.Aeson (FromJSON, ToJSON)
import qualified Data.Text as T
import GHC.Generics (Generic)
import Language.Plutus.Contract
import qualified Language.PlutusTx as PlutusTx
import Language.PlutusTx.Prelude
import Ledger
import qualified Ledger.Ada as Ada
import qualified Ledger.Constraints as Constraints
View Ansi.hs
-- https://docs.rs/ansi_term/0.12.1/x86_64-pc-windows-msvc/src/ansi_term/windows.rs.html#10-61
enableAnsiSupport :: IO (Either String Bool)
enableAnsiSupport = handleIO (pure . Left . displayException) $ do
h <- createFile "CONOUT$" (gENERIC_WRITE .|. gENERIC_READ) fILE_SHARE_WRITE Nothing oPEN_EXISTING 0 Nothing
when (h == iNVALID_HANDLE_VALUE ) $ fail "invalid handle value"
m <- getConsoleMode h
if ((m .&. eNABLE_VIRTUAL_TERMINAL_PROCESSING) == 0)
then setConsoleMode h (m .|. eNABLE_VIRTUAL_TERMINAL_PROCESSING) >> pure (Right True)
else pure (Right False)
View bootstrap-haskell
#!/bin/sh
# Main settings:
# * BOOTSTRAP_HASKELL_NONINTERACTIVE - any nonzero value for noninteractive installation
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
# * GHCUP_USE_XDG_DIRS - any nonzero value to respect The XDG Base Directory Specification
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
# * BOOTSTRAP_HASKELL_GHC_VERSION
# * BOOTSTRAP_HASKELL_CABAL_VERSION
View keymap.json
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "kinesis/stapelberg",
"keymap": "workman",
"layout": "LAYOUT",
"layers": [
[
"KC_ESC",
View etc_effort_base_01.conf
# The baseline effort is based on the distance required
# to reach each key position. Assumed here is a standard 101-key
# layout and conventional finger placement. These distances are
# combined with other typing effort model parameters, such as
# key-finger assignment, finger penalties, hand penalties,
# and path stroke.
#
# The units of distance are arbitrary, but their relative values
# should correspond to actual key distances.
View brightness.sh
#!/bin/sh
# Set brightness values for each status.
# Range from 1 to 100 is valid
brightness_day=90
brightness_transition=70
brightness_night=50
# Set fps for smoooooth transition
fps=1000