Skip to content

Instantly share code, notes, and snippets.

View robertknight's full-sized avatar

Robert Knight robertknight

View GitHub Profile
@robertknight
robertknight / show-merge-status.rb
Created January 2, 2013 18:43
Script to print out the merge status of local branches with respect to an 'upstream' branch (by default, 'master'). For each local branch, it prints out the number and one-line summaries of commits that have not been merged. Run with the -m argument to print out just the merge status of each branch. The script looks at the diff introduced by com…
#!/usr/bin/env ruby
require 'optparse.rb'
upstream_branch = "master"
branch_names = []
show_merge_status = false
OptionParser.new do |parser|
parser.banner = <<END
{"elements":[{"type":".Title","label":"Bigtable: A Distributed Storage System for Structured Data\\n\\n","positions":[{"type":".PdfPosition","offsets":[0,1,2,3,4,5,6,7,8,10,12,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,32,33,34,35,36,37,39,40,41,43,44,45,46,47,48,49,50,51,52,54,55,56,57],"boundingBox":{"minx":122.52,"miny":124.44,"maxx":489.19406,"maxy":667.56},"pageId":1}]},{"type":".Section","children":[{"type":".Section","children":[],"label":"4 Building Blocks\\n\\n","positions":[{"type":".PdfPosition","offsets":[10693,10695,10696,10697,10698,10699,10700,10701,10702,10704,10705,10706,10707,10708,10709],"boundingBox":{"minx":314.9994,"miny":268.80017,"maxx":413.578,"maxy":523.1998},"pageId":3}]},{"type":".Section","children":[],"label":"5 Implementation\\n\\n","positions":[{"type":".PdfPosition","offsets":[14056,14058,14059,14060,14061,14062,14063,14064,14065,14066,14067,14068,14069,14070,14071],"boundingBox":{"minx":71.99955,"miny":129.23993,"maxx":171.41548,"maxy":662.7601},"pageId":4}]},{"type":
function termFreqMap(str) {
var words = str.split(' ');
var termFreq = {};
words.forEach(function(w) {
termFreq[w] = (termFreq[w] || 0) + 1;
});
return termFreq;
}
function addKeysToDict(map, dict) {
@robertknight
robertknight / webkit-75984-workaround.html
Created April 23, 2013 16:44
Workaround for https://bugs.webkit.org/show_bug.cgi?id=75984 - adds a wrapper around QtObject.method.connect() which registers the method in an array and disconnects the method when the document is unloaded.
<html>
<body>
<script>
// wrappers around QtObject.methodName.connect()
// workaround for https://bugs.webkit.org/show_bug.cgi?id=75984
window.qtSignals = [];
// connect a Qt signal to a JS function and register it for disconnection
// when the document is unloaded
function connectQtSignal(signal, func) {
@robertknight
robertknight / gist:5508364
Created May 3, 2013 10:19
Table actions menu
diff --git a/src/webContent/notes/summary.html b/src/webContent/notes/summary.html
index 63a23cb..a519377 100644
--- a/src/webContent/notes/summary.html
+++ b/src/webContent/notes/summary.html
@@ -30,7 +30,7 @@
<div class="table-data" id="{{elementId}}-table-data">{{{table}}}</div>
<div class="table-actions">
<a class="table-copy-link" id="{{elementId}}-copy-link" href="#copy-table"
- title="Copy table data">Copy</a>
+ title="Copy table data">Options</a>
<html><head><title>Apache Tomcat/7.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.web.util.NestedServletException: Request processi
@robertknight
robertknight / labels.json
Created June 21, 2013 14:50
Label schema file
[
{
"label": "abstract",
"color": "#dddddd"
},
{
"label": "address-other",
"color": "#dddddd"
},
{
@robertknight
robertknight / list.cpp
Created October 13, 2013 13:56
Trivial Qt app which displays a sorted list of items
#include <QtCore/QStringListModel>
#include <QtWidgets/QApplication>
#include <QtWidgets/QListView>
#include <algorithm>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QListView view;
@robertknight
robertknight / list-preprocessed.cpp
Created October 13, 2013 14:00
Preprocessed output of list.cpp
This file has been truncated, but you can view the full file.
# 1 "test.cpp"
# 1 "<command-line>"
# 1 "test.cpp"
# 1 "/usr/include/qt5/QtCore/QStringListModel" 1
# 1 "/usr/include/qt5/QtCore/qstringlistmodel.h" 1
# 45 "/usr/include/qt5/QtCore/qstringlistmodel.h"
# 1 "/usr/include/qt5/QtCore/qabstractitemmodel.h" 1
# 45 "/usr/include/qt5/QtCore/qabstractitemmodel.h"
# 1 "/usr/include/qt5/QtCore/qvariant.h" 1
# 45 "/usr/include/qt5/QtCore/qvariant.h"
@robertknight
robertknight / runtime-gdb.py.diff
Last active December 31, 2015 10:28
Patch for Python 2.6/3.x compatibility for Golang GDB runtime support
diff -r 24bc2c8febe3 src/pkg/runtime/runtime-gdb.py
--- a/src/pkg/runtime/runtime-gdb.py Sat Dec 14 10:03:11 2013 +1100
+++ b/src/pkg/runtime/runtime-gdb.py Sun Dec 15 13:19:47 2013 +0000
@@ -14,10 +14,12 @@
# foo string' will make foo a plain struct in the eyes of gdb,
# circumventing the pretty print triggering.
+from __future__ import print_function
+from __future__ import unicode_literals