Skip to content

Instantly share code, notes, and snippets.

View misberner's full-sized avatar

Malte Isberner misberner

  • Red Hat
  • Bochum, Germany
View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
git_dir="$(git rev-parse --git-dir)"
list_reflog_entries() {
git log --walk-reflogs --grep-reflog '^checkout: moving from ' --format='%gs'
}
package conformance
import (
"google.golang.org/protobuf/proto"
"testing"
)
const (
numObjects = 1000
)
#!/usr/bin/env python3
import sys
import yaml
def fix_descriptor_order(descriptors):
# Perform a stable sort (in Python, sorts are always stable) based on the path (excluding the last
# component). This ensures items at the same nesting level retain their relative order, and children
# will always come after their parents.
# We add a `.` in front for simplicity, to ensure every key contains at least one dot. This will have
void __VERIFIER_error(int i) {
fprintf(stderr, "error_%d\n", i);
assert(0);
}
#define __VERIFIER_error(x) \
do { \
int error_ ## x = 0; \
assert(error_ ## x); \
} while(0)
@misberner
misberner / gist:49ab70c425a495b8100f
Created July 21, 2014 17:56
Selftype and Inheritance
abstract class MyComparable[D <: MyComparable[D]] {
this: D =>
def <=(other: D)
def >=(other: D) = (other <= this) // would fail without selftype
// ...
}
abstract class MyEnhancedComparable[D <: MyEnhancedComparable[D]] extends MyComparable[D] {
@misberner
misberner / file-excludes.sublime-settings
Created January 8, 2014 13:58
Reasonable file exclude settings for Sublime Text
{
"file_exclude_patterns":
[
// Executable binaries
"*.so",
"*.a",
"*.exe",
"*.dll",
"*.lib",
"*.dylib",
@misberner
misberner / .gitignore-latex
Created January 8, 2014 13:39
.gitignore rules for LaTeX projects
# LaTeX temporary files
*.aux
*.log
*.toc
# PDF output - usually a bad idea to keep this in Git
*.pdf
# Latexmk
*.fdb_latexmk