Skip to content

Instantly share code, notes, and snippets.

View mkohlhaas's full-sized avatar

Michael Kohlhaas mkohlhaas

View GitHub Profile
@mkohlhaas
mkohlhaas / gist:85771d0d3a03ddaccd9d146108edc552
Last active December 1, 2023 18:02
FFI Playground Pharo
index := FFITutorial createIndex: 0 display: 0.
tu := FFITutorial parseTranslationUnit: 'tst.h' index: index
'tst.h' asFileReference absolutePath
'tst.h' asFileReference contents
"struct foo {
int bar;
int *bar_pointer;
};
@mkohlhaas
mkohlhaas / hamlet.txt
Created November 18, 2023 15:34
Word count in Pharo/Smalltalk
splitChars := {Character space . Character lf . $, . $. . $! . $? . $' . $: . $; . $- . $_ . $? . $! . $´}.
rawWords := 'hamlet.txt' asFileReference contents substrings: splitChars.
words := rawWords collect: [:word | word asLowercase trimBoth] thenSelect: [:word | word size > 3 ].
words asBag sortedCounts.
require 'fdb'
FDB.api_version 730
####################################
## Initialization ##
####################################
# Data model:
# ['attends', student, class] = ''
@mkohlhaas
mkohlhaas / gist:2251cb3e32ba0ac08af32e742582ec7a
Created October 20, 2023 00:34
raylib building and installation
# https://gitlab.archlinux.org/archlinux/packaging/packages/raylib/-/blob/main/PKGBUILD
git clone https://github.com/raysan5/raylib.git
cmake -B build -D BUILD_EXAMPLES=OFF -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_FLAGS="$CFLAGS -fPIC -w" -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_INSTALL_PREFIX=/usr -D OpenGL_GL_PREFERENCE=GLVND -D PLATFORM=Desktop -D USE_EXTERNAL_GLFW=OFF -D WITH_PIC=ON -G Ninja -S raylib -W no-dev
ninja -C build
sudo ninja -C build install
@mkohlhaas
mkohlhaas / gist:22fdcf05017e0ab834588bf327143673
Last active October 10, 2023 04:09
Install Android Emulator
sdkmanager --list
sdkmanager "system-images;android-34;google_apis;x86_64"
avdmanager create avd -n tst -k "system-images;android-34;google_apis;x86_64"
flutter emulators
flutter emulators --launch tst
flutter devices
flutter run -d emulator-5554
avdmanager list
avdmanager create avd -n galaxy -k "system-images;android-34;google_apis;x86_64" -d 1
let upstream =
https://github.com/purerl/package-sets/releases/download/erl-0.15.3-20220629/packages.dhall
sha256:48ee9f3558c00e234eae6b8f23b4b8b66eb9715c7f2154864e1e425042a0723b
in upstream
[WARN][2022-02-23 15:41:50] ...lsp/handlers.lua:406 "Found multiple IDE server executables; using node_modules/.bin/purs"
[WARN][2022-02-23 15:44:08] .../lua/vim/lsp.lua:751 "server_request: no handler found for" "workspace/semanticTokens/refresh"
[WARN][2022-02-23 15:44:08] .../lua/vim/lsp.lua:751 "server_request: no handler found for" "workspace/semanticTokens/refresh"
[WARN][2022-02-23 15:44:08] .../lua/vim/lsp.lua:751 "server_request: no handler found for" "workspace/semanticTokens/refresh"
[WARN][2022-02-23 15:44:08] .../lua/vim/lsp.lua:751 "server_request: no handler found for" "workspace/semanticTokens/refresh"
[START][2022-02-23 15:44:38] LSP logging initiated
[INFO][2022-02-23 15:44:38] .../vim/lsp/rpc.lua:261 "Starting RPC client" { args = { "--stdio" }, cmd = "purescript-language-server", extra = { cwd = "/home/schmidh/Gitrepos/qqqq", env = { PATH = "/home/schmidh/.local/share/nvim/lsp_servers/purescript/node_modules/.bin:./node_modules/.bin/:/home/schmidh/.npm/bin:/home/schmidh/.carg
module Ch21 where
import Prelude
import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, throwError)
import Control.Monad.Except.Trans (ExceptT, runExceptT)
import Control.Monad.Reader.Class (class MonadAsk, ask)
import Control.Monad.State.Class (class MonadState, get, put)
import Control.Monad.Trans.Class (class MonadTrans, lift)
import Control.Monad.Writer.Class (class MonadTell, tell)
module Ch19RWS where
import Prelude
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Console (log)
-- rewrite Reader, Writer and State data types which are monads for your own reference
-- you might want to comment out the code