Skip to content

Instantly share code, notes, and snippets.

@delcypher
delcypher / hamming.c
Last active July 18, 2017 12:57
Check equivalence with KLEE
#include "klee/klee.h"
#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
//types and constants used in the functions below
const uint64_t m1 = 0x5555555555555555; //binary: 0101...
const uint64_t m2 = 0x3333333333333333; //binary: 00110011..
const uint64_t m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
const uint64_t m8 = 0x00ff00ff00ff00ff; //binary: 8 zeros, 8 ones ...
@delcypher
delcypher / test_subnormal_result_implies_exact_result.c
Created December 2, 2016 12:40
Approximately check if result of addition is subnormal with KLEE
#include "klee/klee.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
int is_subnormal(float f) {
return fpclassify(f) == FP_SUBNORMAL;
}
int main() {
@delcypher
delcypher / fuzz_subnormal_result_implies_exact.c
Created December 2, 2016 13:15
Fuzzing "subnormal result implies exact result with LibFuzzer"
#include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int is_subnormal(float f) {
return fpclassify(f) == FP_SUBNORMAL;
@delcypher
delcypher / fuzz_subnormal_result_implies_exact.c
Created December 2, 2016 14:08
Use LibFuzzer to look for violations of the result of floating point addition being subnormal implying
#include <assert.h>
#include <fenv.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int is_subnormal(float f) {
@delcypher
delcypher / # llvm34 - 2016-12-18_23-15-29.txt
Created December 18, 2016 23:17
llvm34 (homebrew/versions/llvm34) on macOS 10.12.2 - Homebrew build logs
Homebrew build logs for homebrew/versions/llvm34 on macOS 10.12.2
Build date: 2016-12-18 23:15:29
@delcypher
delcypher / PKGBUILD
Created January 22, 2017 19:30
Hacked version of PKGBUILD for AUR build of git-lfs
# Maintainer: Michael Schubert <mschu.dev at gmail>
# Contributor: Mikkel Oscar Lyderik <mikkeloscar at gmail dot com>
pkgname=git-lfs
pkgver=1.5.5
pkgrel=1
pkgdesc="An open source Git extension for versioning large files"
arch=('i686' 'x86_64' 'armv7h')
url="https://${pkgname}.github.com"
license=('MIT')
makedepends=('go' 'ruby-ronn')
@delcypher
delcypher / idrac_auth.sh
Created July 7, 2017 14:39
Enable iDRAC web access ADMIN privilidge
#!/bin/bash
# Based on http://lists.us.dell.com/pipermail/linux-poweredge/2013-April/047905.html
set -x
set -e
set -o pipefail
function usage() {
echo "$0 <user_id>"
}
@delcypher
delcypher / smt2
Last active February 15, 2019 09:36
Proof that an equality (that would be useful if true) does not hold
;;
;; Prove that
;; (x -y) >> 3 != ((x >> 3) - (y >> 3))
;;
;; if x >= y
;;
;;
(declare-fun x () (_ BitVec 32))
(declare-fun y () (_ BitVec 32))
(declare-fun shift () (_ BitVec 32))