Skip to content

Instantly share code, notes, and snippets.

View jroelofs's full-sized avatar

Jon Roelofs jroelofs

View GitHub Profile
@jroelofs
jroelofs / morris.cpp
Created May 17, 2020 16:20
Sandbox experimentation on Morris Traversal
#include <memory>
#include <iostream>
struct Tree {
int data;
std::unique_ptr<Tree> left;
std::unique_ptr<Tree> right;
Tree(int data,
std::unique_ptr<Tree> &&left,
@jroelofs
jroelofs / json-diff.py
Last active July 31, 2020 18:08
JSON diff tool
#!/usr/bin/env python3
# Finds the structural diff of two json files, ignoring formatting
# changes that a normal diff would highlight.
import json
import sys
def usage():
@jroelofs
jroelofs / toy-reassociate-matmul.diff
Created April 15, 2020 16:11
Matrix-Matrix multiply chain re-association for MILR's Toy examaple
commit 8ad8f04b2c4abec358d69d45870e80f50e3ccc22
Author: Jon Roelofs <[email protected]>
Date: Tue Apr 14 16:23:13 2020 -0600
WIP: reassociate matrix-matrix multiply chains
diff --git a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp
index fafc3876db2..ee9a1205845 100644
--- a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp
+++ b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp
diff --git a/llvm/include/llvm/Support/FileCheck.h b/llvm/include/llvm/Support/FileCheck.h
index 429e36cfcbb..5925fa811ca 100644
--- a/llvm/include/llvm/Support/FileCheck.h
+++ b/llvm/include/llvm/Support/FileCheck.h
@@ -61,7 +61,10 @@ enum FileCheckKind {
CheckBadNot,
/// Marks when parsing found a -COUNT directive with invalid count value.
- CheckBadCount
+ CheckBadCount,
@jroelofs
jroelofs / has_feature_fuzzer.diff
Created March 25, 2020 15:52
__has_feature(fuzzer)
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 4c7af39e93e..85eca5034fb 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2823,8 +2823,8 @@ Extensions for Dynamic Analysis
Use ``__has_feature(address_sanitizer)`` to check if the code is being built
with :doc:`AddressSanitizer`.
-Use ``__has_feature(thread_sanitizer)`` to check if the code is being built
-with :doc:`ThreadSanitizer`.
@jroelofs
jroelofs / notty.cpp
Last active March 9, 2020 15:40
Inverted std::optional's
// Utility that makes it a little bit nicer to
// invert the condition on assignment from optional:
// if ((Not{foo} = maybeMakeFoo()) {
// std::cerr << "can't make foo\n";
// }
#include <optional>
template<typename T>
struct Not {
@jroelofs
jroelofs / gpg-git-smudge-clean.md
Created February 19, 2016 13:12 — forked from g-k/gpg-git-smudge-clean.md
test transparent git encryption with smudge clean filters using gpg

Generate a GPG Key and revocation cert per http://www.gnupg.org/gpg/en/manual.html:

gpg --key-gen
gpg --output revoke.asc --gen-revoke <my user ID or email>

Once gpg key in keyring we can encrypt and decrypt files.

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 244611)
+++ CMakeLists.txt (working copy)
@@ -166,7 +166,7 @@
# Setup Compiler Flags
#===============================================================================
-include(HandleLibCXXABI) # Steup the ABI library flags
+include(HandleLibCXXABI) # Setup the ABI library flags
@jroelofs
jroelofs / README.md
Last active August 29, 2015 14:22
Diff program for JSON dictionaries

JSON Differ

Usage

$ jdiff.py from-file to-file
@jroelofs
jroelofs / README.md
Last active October 20, 2019 11:11
Git commit message hook

Git Commit Message Hook

Installation

$ mv commit-msg* .git/hooks
$ chmod u+x .git/hooks/commit-msg*

Use