Skip to content

Instantly share code, notes, and snippets.

View mniip's full-sized avatar
😼

mniip mniip

😼
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/hidraw.h>
type MLens m s t a b = forall f. Traversable f => (a -> Compose m f b) -> s -> Compose m f t
mlens :: Monad m => (s -> m a) -> (s -> b -> m t) -> MLens m s t a b
mlens get set h s = Compose $ get s >>= getCompose . h >>= traverse (set s)
type MGetting m r s a = (a -> Compose m (Const r) a) -> s -> Compose m (Const r) s
mview :: Applicative m => MGetting m a s a -> s -> m a
mview l s = fmap getConst . getCompose $ l (\a -> Compose (pure (Const a))) s
@mniip
mniip / LC.hs
Last active October 30, 2018 14:00
{-# OPTIONS_GHC -fno-warn-tabs -Wno-missing-fields #-}
import Control.Applicative
import Control.Monad
import Control.Monad.Yoctoparsec
import Data.Char
import Data.List
import qualified Data.Map as M
import Data.Maybe
import qualified Data.Set as S
import System.Environment
CC= gcc
CFLAGS= -g
CPPFLAGS=
LINKFLAGS=
SOURCE=resizexfs.c
EXE=resizexfs
all: $(EXE)
typedef struct { int ix; char const *str; } entry;
entry list_class[] = {
{ELFCLASSNONE, "ELFCLASSNONE"},
{ELFCLASS32, "ELFCLASS32"},
{ELFCLASS64, "ELFCLASS64"},
{0, 0}
};
entry list_data[] = {
{-# LANGUAGE TypeOperators, KindSignatures, DataKinds, PolyKinds, GADTs, RankNTypes, StandaloneDeriving, InstanceSigs, ScopedTypeVariables #-}
module GHC.TypeLits.Singletons
(
NatSingleton(..),
NatIsZero(..), induceIsZero,
NatUnary(..), induceUnary,
NatTwosComp(..), induceTwosComp,
NatBaseComp(..), induceBaseComp,
local function pretty_print(term)
local introduced = {}
local total = {}
local function mark(seen, obj, from)
if seen[obj] then
introduced[obj] = from
else
seen[obj] = true
end
end
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/user.h>
#include <sys/ptrace.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
char var_1;
char var_2;
asm (
1{
x
s/$/000000000/
x
}
x
H
s/./&,/g
s/0//g
s/1/x/g