Skip to content

Instantly share code, notes, and snippets.

View dannypsnl's full-sized avatar

Lîm Tsú-thuàn dannypsnl

View GitHub Profile
@dannypsnl
dannypsnl / tcp_flags.txt
Created June 21, 2019 06:34 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@dannypsnl
dannypsnl / Lexer.hs
Created August 23, 2019 03:35 — forked from osa1/Lexer.hs
separated lexing and parsing stages in parsec
module Lexer
( Token(..)
, TokenPos
, tokenize
) where
import Text.ParserCombinators.Parsec hiding (token, tokens)
import Control.Applicative ((<*), (*>), (<$>), (<*>))
data Token = Ide String
@dannypsnl
dannypsnl / grad-typings-reduction.rkt
Created September 18, 2020 21:17 — forked from dvanhorn/grad-typings-reduction.rkt
A reduction semantics for explore more static annotations
#lang racket
(require redex)
;; Run to explore all of the gradual typings of the example
(define (main)
(traces -> (term example)))
(define-term example
(λ (x : ?)
(λ (y : ?)
@dannypsnl
dannypsnl / PrettyParseError.hs
Created October 12, 2020 04:41 — forked from lynn/PrettyParseError.hs
Pretty ParseErrors for Text.Parsec
module PrettyParseError (
prettyParseError,
PrettyParseErrorOptions(PrettyParseErrorOptions),
prettyParseErrorDefaults
) where
import Data.List (intercalate, nub)
import Text.Parsec
import Text.Parsec.Error
import Text.Parsec.Pos
@dannypsnl
dannypsnl / 0-env.rkt
Created February 18, 2021 13:07 — forked from shhyou/0-env.rkt
Compilation-time Environment
;; Exporting free identifier table operations that close over a global map
#lang racket/base
(require racket/list
syntax/id-table)
(provide env-ref env-has-id? env-add!)
(define id-table (make-free-id-table))
#lang racket
(require cpsc411/compiler-lib)
(module+ a
;; Compiler style
(define (expand e)
(define (expand-expr e)
(match e
[`(and ,e1 ,e2)
@dannypsnl
dannypsnl / octal_x86.txt
Created February 18, 2022 15:45 — forked from seanjensengrey/octal_x86.txt
x86 is an octal machine
# source:http://reocities.com/SiliconValley/heights/7052/opcode.txt
From: mark@omnifest.uwm.edu (Mark Hopkins)
Newsgroups: alt.lang.asm
Subject: A Summary of the 80486 Opcodes and Instructions
(1) The 80x86 is an Octal Machine
This is a follow-up and revision of an article posted in alt.lang.asm on
7-5-92 concerning the 80x86 instruction encoding.
The only proper way to understand 80x86 coding is to realize that ALL 80x86
@dannypsnl
dannypsnl / SPropSketch.hs
Created June 15, 2022 05:34 — forked from atennapel/SPropSketch.hs
SProp sketch
{-# LANGUAGE PatternSynonyms #-}
type Ix = Int
type Lvl = Int
type ULvl = Int
data Sort = Type ULvl | Prop
deriving (Show, Eq)
data SortType = SType | SProp
@dannypsnl
dannypsnl / natmod.agda
Created July 19, 2023 06:33 — forked from Trebor-Huang/natmod.agda
Free natural model as an HIIT
{-# OPTIONS --cubical #-}
module natmod where
open import Cubical.Foundations.Prelude
data Ctx : Type
data _⊢_ : Ctx → Ctx → Type
data Ty : Ctx → Type
data Tm : Ctx → Type
-- This is halfway between EAT and GAT.
-- GAT is hard! Why is EAT so easy?
@dannypsnl
dannypsnl / pcomb.ml
Created August 7, 2023 15:29 — forked from neel-krishnaswami/pcomb.ml
A linear-time parser combinator library in Ocaml
module C : sig
type t
val empty : t
val one : char -> t
val union : t -> t -> t
val inter : t -> t -> t
val top : t
val mem : char -> t -> bool
val make : (char -> bool) -> t
val equal : t -> t -> bool