Skip to content

Instantly share code, notes, and snippets.

View ChristophP's full-sized avatar

ChristophP

View GitHub Profile

Lazyvim cheat sheet

Navigation

  • <leader>-e open tree
  • <leader>-f find file by name
  • <leader>-/ find text

Commenting

@ChristophP
ChristophP / Effects.elm
Created January 4, 2023 15:46
Example of the effects pattern in Elm
port module Effects exposing (Effect(..), toCmd)
import Api
import Browser.Dom as Dom
import Browser.Navigation as Nav
import Date exposing (Date)
import Json.Encode as JE
import Task
@ChristophP
ChristophP / WASM_WASI_Notes.md
Last active July 14, 2022 14:15
Stuff I've learned about WASM and WASI

WASM and WASI Notes

Web Assembly can make use of OS capabilities with the Web Assembly System Interface. It allows calls to OS functionality like clock, fs, network etc.

Spec

  • WASM is the fourth W3C web standard next to HTML, CSS and JS
  • WASI is an additional spec that standardizes how Web Assembly can do more than just run in a sandboxed environment but interact with system resources.

Ecosystem

rg --files-with-matches 'foo' | xargs -L 1 -o vim -c '%s/foo/bar/gc'
@ChristophP
ChristophP / stream-to-node-stdin.sh
Last active July 16, 2020 15:00
Streaming to an application in shell using output grouping
{ while :; do echo test; sleep 5; done } | node -e 'process.stdin.on("data", () => process.stdout.write("Peter"))'
@ChristophP
ChristophP / assume-role.sh
Created May 15, 2020 14:55
little shell script which can be sourced to act on behalf of an IAM role in AWS.
#!/usr/bin/env sh
# this script will modify your environment
# so that you can work in the context of an assumed role in AWS
set -u
if [ -z ${ASSUME_ROLE_ARN+x} ]
then
echo "NO ASSUME_ROLE_ARN variable configured in Environment.";
@ChristophP
ChristophP / new-pet-stack.sh
Last active February 5, 2022 07:32
Quickly scaffold a new app using the parcel bundler, Elm and TailwindCSS
#!/usr/bin/env sh
set -eu
# checking input
[ -z ${1:-} ] && echo "Missing directory name. Call this script with a directory name you want to create." && exit 1;
DIR=$1
[ -d $DIR ] && echo "Directory ${DIR} already exists. I need a fresh directory." && exit 1;
# scaffolding of dirs and files
@ChristophP
ChristophP / git-bisect-example.sh
Last active May 5, 2019 19:21
git bisect example
# MANUAL RUN
git checkout <KNOWN_BAD_COMMIT>
git bisect start
git bisect bad
git bisect good <KNOWN_GOOD_COMMIT>
# cycle till done
git bisect log # to check what you've done so far
<test if good or bad>
git bisect bad|good
@ChristophP
ChristophP / OccuranceCount.hs
Last active April 16, 2019 19:36
count occurance of words in a sentence
module OccuranceCount where
import Data.Foldable (foldl')
countWord :: String -> String -> Int
countWord needle =
foldl' (\acc word -> if word == needle then acc + 1 else acc) 0 . words
@ChristophP
ChristophP / Highlight.elm
Last active March 10, 2019 13:33
Elm snippet to highlight text for when searching
module Highlight exposing (highlight, interweave)
type Html msg
= Mark (List (Html msg))
| Text String
mark _ children =
Mark children