Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
Staring

Julian Ospald hasufell

👀
Staring
View GitHub Profile
@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
View alltypes.h
#define _Addr int
#define _Int64 long long
#define _Reg int
#if __GNUC__ >= 3
#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
typedef __builtin_va_list va_list;
#define __DEFINED_va_list
#endif
View 0001-Don-t-prematurely-fail-during-configure-due-to-pkg-c.patch
From 382e3e0ed04f43351133fff3f1e6ad6655c6b4e3 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Sat, 9 May 2020 22:48:18 +0200
Subject: [PATCH] Don't prematurely fail during configure due to pkg-config
---
Cabal/Distribution/Simple/Configure.hs | 32 +++-----------------------
1 file changed, 3 insertions(+), 29 deletions(-)
diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs
@hasufell
hasufell / Setup.hs
Last active May 9, 2020
Optional pkg-config detection with cabal
View Setup.hs
import Control.Exception ( SomeException
, handle
, try
)
import Control.Applicative
import Control.Monad
import Data.Char
import Data.List
import Data.Maybe
import Data.Monoid
View 0001-Fix-build-with-base-4.13.patch
From 3b6ff38dd26b8319a4d68d6998e6298857daeb6c Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Wed, 25 Mar 2020 23:11:55 +0100
Subject: [PATCH] Fix build with base >= 4.13
---
Codec/Compression/BZip/Stream.hsc | 8 ++++++++
bzlib.cabal | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)