Skip to content

Instantly share code, notes, and snippets.

View skazhy's full-sized avatar

Kārlis Lauva skazhy

View GitHub Profile
@skazhy
skazhy / asm.py
Created December 23, 2017 18:48
AoC, day 23, puzzle 2
# Step-by-step reverse engineering of day 23 / problem 2.
# Initial statate:
# `a` register set to 0, all others to 0.
# 1. set b 93
# 2. set c b
# 3. jnz a 2 (to:x0)
# 4. jnz 1 5 (to:x1)
# 5. mul b 100 (from:x0)
@skazhy
skazhy / anti_forgery.clj
Created January 10, 2018 08:01
anti_forgery_async.clj
(defn wrap-anti-forgery
"Middleware that prevents CSRF attacks. Any POST request to the handler
returned by this function must contain a valid anti-forgery token, or else an
access-denied response is returned.
The anti-forgery token can be placed into a HTML page via the
*anti-forgery-token* var, which is bound to a random key unique to the
current session. By default, the token is expected to be in a form field
named '__anti-forgery-token', or in the 'X-CSRF-Token' or 'X-XSRF-Token'
headers.
@skazhy
skazhy / jargon_spell.md
Created March 24, 2020 09:45
Creating project-specific spellcheck files for Vim

If you want to write technical documentation in Vim with spell check enabled, but do not want to put project-specific jargon in global spell check files, you can create project-specific spellfiles.

First, ensure that markdown files have spell check enabled (either via autocmd or an ftplugin file): setlocal spell spelllang=en_us, Then create a file with some project-specific words in it (it can be empty in the beginning as well, it's okay!)

monadic