Skip to content

Instantly share code, notes, and snippets.

View mklinik's full-sized avatar

Markus Klinik mklinik

  • The Netherlands
View GitHub Profile
@mklinik
mklinik / astroid-gdb-attachment-segfault.txt
Created March 24, 2023 08:48
astroid attach file segfault gdb log and backtrace
$ gdb astroid
GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
@mklinik
mklinik / Main.hs
Created December 8, 2021 10:46
Minimal example for the servant-pagination Next-Range issue
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
module Printf where
int :: (String -> a) -> String -> Int -> a
int cont str n = cont (str ++ show n)
lit :: String -> (String -> a) -> String -> a
lit l cont str = cont (str ++ l)
str :: (String -> a) -> String -> String -> a
str cont str s = cont (str ++ s)
$ cabal install
Resolving dependencies...
Configuring vimus-0.0.0...
Building vimus-0.0.0...
Preprocessing executable 'vimus' for vimus-0.0.0...
src/Main.hs:1:1:
Could not find module `Prelude'
It is a member of the hidden package `base'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
@mklinik
mklinik / gist:5831561
Created June 21, 2013 14:31
How to install Haskell from scratch
How to install Haskell from scratch
-----------------------------------
- Attention: There is a matching version of GHC for each version of Haskell
Platform, make sure you check to install the one matching the Haskell
Platform you plan to install
- Download binary GHC package from http://www.haskell.org/ghc/
- Unpack, then:
$ export VERSION=7.4.1 # adapt
$ cd ghc-$VERSION
getMessageState :: State [Message] Message
getMessageState [] = undefined
The equation(s) for `getMessageState' have one argument,
but its type `State [Message] Message' has none
import Control.Monad.State
data Message = MsgA | MsgB
deriving (Show, Eq)
class Monad m => MonadHmud m where
getMessage :: m Message
instance MonadHmud IO where
getMessage = do
import qualified Random
-- randomEnum :: (Enum a, Bounded a) => IO a
randomEnum = do
let minBoundInt = fromEnum (minBound::a)
let maxBoundInt = fromEnum (maxBound::a)
randomInt <- Random.randomRIO (minBoundInt, maxBoundInt)
return $ toEnum randomInt
updatePid :: H.HashTable Int Window -> Window -> X ()
updatePid pidhash w = do
mpid <- getProp32s "_NET_WM_PID" w
pid <- mpid
H.update pidhash (fromIntegral $ fromJust pid) w
return ()