Skip to content

Instantly share code, notes, and snippets.

@cramja
cramja / ReflectionTest.java
Created Jun 2, 2018
Understand the performance impact of reflection
View ReflectionTest.java
import com.google.common.collect.ImmutableMap;
import com.google.common.math.Stats;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ReflectionTest {
public interface FooGetter {
View LICENSE
-------------------------- AUTONOMIC PROPRIETARY 1.0 --------------------------
Copyright (c) 2016, Autonomic Incorporated - All rights reserved
Proprietary and confidential.
NOTICE: All information contained herein is, and remains the property of
Autonomic Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Autonomic Incorporated
and its suppliers and may be covered by U.S. and Foreign Patents, patents in
@cramja
cramja / d3_example_1.html
Last active Apr 6, 2017
Example of updates with merging in d3
View d3_example_1.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
text {
font: bold 48px monospace;
}
.enter {
fill: green;
@cramja
cramja / d3_example_0.html
Created Apr 6, 2017
making some circles and lines in d3
View d3_example_0.html
<!DOCTYPE html>
<style>
button {
position: absolute;
top: 10px;
left: 10px;
}
circle {
@cramja
cramja / qs-apache-rc-email-template.txt
Created Mar 4, 2017
Simple Apache Quickstep RC email template
View qs-apache-rc-email-template.txt
Subject: [VOTE] Apache Incubating Quickstep {VERSION} RC{CANDIDATE}
This vote is for approval of the Quickstep-{VERSION} RC{CANDIDATE}.
Voters should download, unpack, build, and test the package before voting.
A +1 vote means that the package passes all tests and meets Apache guidelines.
A -1 vote should be accompanied with a short reason.
Votes will remain open for 3 days.
@cramja
cramja / make-release.sh
Created Feb 20, 2017
Quickstep release alpha script
View make-release.sh
# Scripts for Releasing Quickstep
#
# Note: This script is a scratch pad with most of the relevent commands.
# Modify it to see fit. We'll finalize it when we understand the
# process better.
# PREREQS:
# - you must have previously created a gpg key using your apache username
# and uploaded it to a keyserver [http://quickstep.apache.org/release-signing/]
# - make sure someone in the group has validated your key
#
@cramja
cramja / ctest_diff.py
Last active Aug 12, 2016
usage: ctest -R your_test > test.out && python ctest_diff.py test.out
View ctest_diff.py
#!/usr/bin/env python
import sys
import re
import os
# regex for useful parts of the diff file
re_start_digits = re.compile(ur'^\d+: ', re.MULTILINE)
re_test_name = re.compile(ur'TRACE,"executing (.*mdp)",', re.MULTILINE)
re_actual = re.compile(ur'TRACE,"Actual:', re.MULTILINE)
@cramja
cramja / gpdb_flags.py
Last active Apr 6, 2017
For manipulating GPDB/ORCA optimization flags
View gpdb_flags.py
#! /usr/#!/usr/bin/env python
import subprocess
xforms = \
[
"CXformAntiSemiJoinAntiSemiJoinNotInSwap",
"CXformAntiSemiJoinAntiSemiJoinSwap",
"CXformAntiSemiJoinInnerJoinSwap",
"CXformAntiSemiJoinNotInAntiSemiJoinNotInSwap",
@cramja
cramja / remove_comments.py
Created Jun 10, 2016
This script removes unused header comments.
View remove_comments.py
#!/usr/bin/python
# This script removes unused header comments. Notice that the file locations are hard coded,
# so change that.
import subprocess as sp
import re
import os
def main():
@cramja
cramja / TestConcurrency.cpp
Created Apr 25, 2016
A snippet to show how to test the StorageManager interface using concurrency and brute-force. An even better test would be to automatically detect deadlock.
View TestConcurrency.cpp
namespace storage_manager_test_internal {
static int client_id = 0;
static const int NUM_BLOBS_PER_CLIENT = 100;
static const int BLOB_SIZE_SLOTS = 1;
static const int CLIENT_CYCLES = 1000;
class StorageClient : public Thread {
public: