Skip to content

Instantly share code, notes, and snippets.

View calebh's full-sized avatar

Caleb Helbling calebh

View GitHub Profile
@calebh
calebh / z3-question.txt
Created December 16, 2021 15:01
Z3 Question
(declare-fun r632 () Real)
(declare-fun v633 () Bool)
(declare-fun v630 () Bool)
(declare-fun v628 () Bool)
(declare-fun v626 () Bool)
(declare-fun v624 () Bool)
(declare-fun v622 () Bool)
(declare-fun v620 () Bool)
(declare-fun v618 () Bool)
(declare-fun v616 () Bool)
@calebh
calebh / variant.cpp
Created April 4, 2021 18:48
C++ variant indexed by integer with no standard library dependency
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@calebh
calebh / model.py
Created May 3, 2020 19:41
Bizzare PyTorch memory issue
import torch
import pickle
import os
import random
import sourcenode
import torch.nn as nn
import torch.utils.checkpoint
import torch.utils.data
import math
import objprocessor
@calebh
calebh / hie.log
Created January 27, 2020 06:56
HIE Error
$ hie.exe
2020-01-27 00:43:25.619924 [ThreadId 3] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "C:\\Users\\caleb\\Documents\\deepdecompilerproject\\dd-c-preprocessor\\stack.yaml"}
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
2020-01-27 00:43:27.9500122 [ThreadId 3] - Module "C:\Users\caleb\Documents\deepdecompilerproject\dd-c-preprocessor\File.hs" is loaded by Cradle: Cradle {cradleRootDir = "C:\\Users\\caleb\\Documents\\deepdecompilerproject\\dd-c-preprocessor", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-27 00:43:27.9500122 [ThreadId 3] - Executing Stack GHC with args: --numeric-version
2020-01-27 00:43:28.4603862 [ThreadId 3] - Executing Stack GHC with args: --print-libdir
2020-01-27 00:43:28.957058 [ThreadId 3] - New cradle: C:\Users\caleb\Documents\deepdecompilerproject\dd-c-preprocessor\test\Spec.hs
2020-01-27 00:43:28.960053 [ThreadId 3] - Cabal-Helper
do
expr1
expr2
expr1 >> expr2
do
x1 <- expr1
x2 <- expr2
expr3
expr1 >>= (\x1 -> (expr2 >>= (\x2 -> expr3)))
typeclassinstance Monad<Nullable> {
Nullable<b> >>= <a,b>(Nullable<a> x, Func<a, Nullable<b>> f) {
if (x.HasValue) {
return f(x.Value);
} else {
return null;
}
}
Nullable<a> return_ <a>(x) {
instance Monad Maybe where
Nothing >>= f = Nothing
(Just x) >>= f = f x
return = Just
instance Monad [] where
xs >>= f = concat (map f xs)
return x = [x]
typeclass Monad<m> {
m<b> >>= <a, b>(m<a>, Func<a, m<b>>);
m<b> >> <a, b>(m<a> x, m<b> y) {
return >>= <a, b>(x, (ignored) => y);
}
m<a> return_ <a>(a);
}
class Monad m where
(>>=) :: m a -> ( a -> m b) -> m b
(>>) :: m a -> m b -> m b
x >> y = x >>= \_ -> y
return :: a -> m a