Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
https://doma.dev

cognivore

💭
https://doma.dev
View GitHub Profile
View gist:313937c16c4cdebeae51e5c99778421a

Monad Stacks

Before you read this: This chapter does not attempt to introduce the concept of a monad in general, it assume this as a given and explains the monads and constructs on top of them that are essential to Lean meta programming. If you don't know what a monad is already you can read (TODO: Link to monad tutorial).

Monad Transformers

Quite often in functional programming with monads one wants to have the power of more than one monad available. Specifically in Lean meta programming it is a very common pattern that we have some sort of read only input, an

@cognivore
cognivore / Dockerfile
Last active Dec 4, 2021
WSL2: No port forwarding to host problem (take 2)
View Dockerfile
FROM gradle:7.3.0-jdk17 as builder
WORKDIR /app
COPY . /app/
RUN gradle --no-daemon bootJar
FROM openjdk:17-slim
COPY --from=builder /app/build/libs/evaluation-task-LATEST.jar /opt/app.jar
EXPOSE 8080
USER 65534:65534
@cognivore
cognivore / DoAuth 0.3 crypto_test.fprof
Last active Nov 9, 2021
DoAuth 0.4 vs 0.3 cryptography test suite profiling dumps
View DoAuth 0.3 crypto_test.fprof
This file has been truncated, but you can view the full file.
Reading trace data...
..................................................
.................................................,
..................................................
.................................................,
.................................
Finished in 5.2 seconds (0.00s async, 5.2s sync)
11 tests, 0 failures
@cognivore
cognivore / loopy-graph.md
Created Jul 16, 2021
Stupid algorithm to enumerate loops in a graph
View loopy-graph.md
  1. Pick random vertex q
  2. Traverse the graph breadth-first until a loop is detected, then stop traversing that branch entirely
    1. If loops that have the same paths are detected on the same level, count only one of those
  3. Delete vertex q and go to 1
View pfwsl.ps1
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}