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

@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

Deterministically Undaunted

Starting Hand

Starting hand every turn is 5.

Casualties

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

@cognivore
cognivore / FLOOR13.TXT
Created September 1, 2024 17:37
Floor 13 Game Manual
___________________________________________________________________________
/#########################################################################\
|#####...####..######..######......####...####..#####..##......##......###|
|####.....###..######..########..#####.....###...####..##..######..#######|
|###..###..##..######..########..####..###..##....###..##..######..#######|
|###..###..##..######..########..####..###..##..#...#..##..######......###|
|###.......##..######..########..####.......##..##.....##..######..#######|
|###..###..##..######..########..####..###..##..###....##..######..#######|
|###..###..##...#####...#######..####..###..##..####...##..######..#######|
|###..###..##......##......##......##..###..##..#####..##......##......###|
@cognivore
cognivore / vite-plugin-zola.ts
Created September 2, 2024 17:03
We heard you like static site generators so we put static site generator into your React website so that you can statically generate while you dynamically generate
import { Plugin } from 'vite';
import fs from 'fs';
import path from 'path';
import { execSync } from 'child_process';
interface ZolaPluginOptions {
zolaOutputDir?: string;
componentDir: string;
manifestFile: string;
zolaBinaryPath?: string;
@cognivore
cognivore / v0.1
Created September 8, 2024 20:37
Astoņkājis.txt
Think of our moments those days,
Days that make helplessness overflow
Will be right behind you,
As you're walking to your home.
Plead you not to die now, as it's
Hard to dig the ground in winter.
River of tears do float me,
Pushing my raft seaward: