Skip to content

Instantly share code, notes, and snippets.

View cognivore's full-sized avatar
💭
https://doma.dev

cognivore

💭
https://doma.dev
View GitHub Profile
$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;
}
@cognivore
cognivore / loopy-graph.md
Created July 16, 2021 18:33
Stupid algorithm to enumerate loops in a graph
  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
@cognivore
cognivore / DoAuth 0.3 crypto_test.fprof
Last active November 9, 2021 01:31
DoAuth 0.4 vs 0.3 cryptography test suite profiling dumps
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 / Dockerfile
Last active December 4, 2021 22:58
WSL2: No port forwarding to host problem (take 2)
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

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

Deterministically Undaunted

Starting Hand

Starting hand every turn is 5.

Casualties

Casualties are first removed from the deck, then discard, then hand.

@cognivore
cognivore / undaunted-draft.md
Last active July 17, 2023 19:26
Undaunted draft

Deck building

You can only have cards of factions that were in a military alliance at some point during the war:

  • Allies & Soviets
  • Allies & Italians
  • Germans & Italians
  • Germans & Soviets