Skip to content

Instantly share code, notes, and snippets.

View dvtate's full-sized avatar
🐧
chilling

Dustin Van Tate Testa dvtate

🐧
chilling
View GitHub Profile
@DreamVB
DreamVB / vm.c
Last active April 9, 2023 16:25
Simple Stack Virtual Machine in C
/*
Simple stack Virtual Machine
Version 1.0
by DreamVB
This is a simple example of how to code a simple VM in C
At the moment this vm only supports a small amount of instruction I hope to add more as I learn more.
This version has some hard coded example that you can test in the vm. Next version I plan to load the examples from files.
If you like this code, or if you have some improvements I can make drop me a message below:
@sbueringer
sbueringer / dkms-module-signing.md
Created October 16, 2019 04:22 — forked from dojoe/dkms-module-signing.md
Make DKMS sign kernel modules on installation, with full script support and somewhat distro independent

On systems with UEFI Secure Boot enabled, recent Linux kernels will only load signed modules, so it's about time DKMS grew the capability to sign modules it's building.

These scripts are extended and scriptified variants of https://computerlinguist.org/make-dkms-sign-kernel-modules-for-secure-boot-on-ubuntu-1604.html and https://askubuntu.com/questions/760671/could-not-load-vboxdrv-after-upgrade-to-ubuntu-16-04-and-i-want-to-keep-secur/768310#768310 and add some error checking, a passphrase around your signing key, and support for compressed modules.

dkms-sign-module is a wrapper for the more generic sign-modules which can also be used outside of DKMS.

Installation

  1. Create a directory under /root, say /root/module-signing, put the three scripts below in there and make them executable: chmod u+x one-time-setup sign-modules dkms-sign-module
@Querijn
Querijn / ddragon_example.js
Last active May 9, 2024 02:04
Get Champion by key or by ID with the latest DDragon version (Javascript)
let championByIdCache = {};
let championJson = {};
async function getLatestChampionDDragon(language = "en_US") {
if (championJson[language])
return championJson[language];
let response;
let versionIndex = 0;
@mstewartgallus
mstewartgallus / profunctor.hs
Last active October 22, 2020 17:53
The kappa/zeta calculus explicitly decompose the typed lambda calculus. Combining the two categories could be represented as a profunctor. I still need to work out the details of the points tho. Decomposing typed lambda calculus into a couple of categorical programming languages http://www.kurims.kyoto-u.ac.jp/~hassei/papers/ctcs95.html
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
import Prelude hiding (Applicative (..), const)
data T = Unit | T :*: T | T :-> T
data Kappa v a b where
IdK :: Kappa v a a
@mstewartgallus
mstewartgallus / onekappa.hs
Last active March 29, 2021 08:41
One object kappa/zeta calculus, kind of like reflexive objects but also weird
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE QuantifiedConstraints #-}
import Prelude hiding (id, (.))
import Control.Category
import Control.Monad.State hiding (lift)
class Category k => Terminal k where
term :: k a ()
@mstewartgallus
mstewartgallus / kappacesk.hs
Last active January 15, 2021 22:45
Latest Cesk kappa calculus interpreter
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
@mstewartgallus
mstewartgallus / sequents.pro
Last active July 28, 2022 05:16
Sequent Calculus style stuff with Prolog. I could probably handle variables better in the future and also improve the DSL a bit. Different search strategies would probably be necessary in a full thing.
:- use_module(library(clpfd)).
:- use_module(library(dcg/basics)).
:- op(1150, xfy, user:(β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”)).
:- op(980, xfy, user:(~~>)).
:- op(980, xfy, user:(~>)).
:- op(980, xfy, user:(*~>)).
:- op(950, xfx, user:(⊨)).
@mstewartgallus
mstewartgallus / kappa.makam
Last active January 23, 2021 02:19
Tried out makam (lambda Prolog dialect) http://astampoulis.github.io/makam/ . Remarkable velocity although poor tooling.
%open syntax.
expr : type.
id : expr.
compose : expr -> expr -> expr.
bang : expr.
v : (_ : string) -> expr.
@mstewartgallus
mstewartgallus / hoas.makam
Created January 24, 2021 04:01
The hoas support is kind of neat but idk.
%open syntax.
%extend kz.
obj : type.
terminal : obj.
fn : obj -> obj -> obj.
tuple : obj -> obj -> obj.
typ : type.
Inductive expr : Set :=
| lit : nat -> expr
| add : expr -> expr -> expr.
(* Define the type of big step semantics *)
Inductive big : expr -> nat -> Prop :=
| big_lit : forall x, big (lit x) x
| big_add : forall x y a b, big x a -> big y b -> big (add x y) (a + b).
(* A step maps a state to a state *)