Skip to content

Instantly share code, notes, and snippets.

View pcj's full-sized avatar

Paul Cody Johnston pcj

View GitHub Profile
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-*color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-*color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
@pcj
pcj / Makefile
Last active August 29, 2015 14:16
Testing CometD in mocha/node.js environment
npm_install:
npm install -g node-gyp
# jsdom must be installed at 3.x; the 4.x versions only run in io.js now.
npm install jsdom@3.1.2
npm install ws jquery-deferred nclosure
mocha_test:
mocha --harmony --recursive --timeout 20000 --reporter spec src/main/js/spec
@pcj
pcj / Makefile
Last active August 29, 2015 14:16
CrossRef API output
get_api:
curl -X GET -H "Content-Type: application/json" http://api.crossref.org/works/10.1148/radiology.206.3.9494508 | python -m json.tool
get_dx:
curl -LH "Accept: application/citeproc+json" http://dx.doi.org/10.1148/radiology.206.3.9494508 | python -m json.tool
@pcj
pcj / README.md
Last active December 26, 2015 09:09 — forked from kerryrodden/.block

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes subgroups of patients.

It is covered by the Apache license:

Copyright 2013 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at >

@pcj
pcj / BUILD.py
Created August 4, 2016 15:02
Possible approach to extensibility of rules_protobuf
# Later, invoke the protobuf_go_library with the language flag. This will
# trigger building of the protobuffer with the grpc-gateway plugin and
# building of the library with the required dependencies.
load("@org_pubref_rules_protobuf//bzl:rules.bzl", "protobuf_go_library")
protobuf_go_library(
protos = ["service.proto"],
srcs = ["service_impl.go"],
@pcj
pcj / SumArray.java
Last active November 17, 2016 15:00
Dynamic Programming Problem
/**
* SumArray. Given an input list of integers 'A' with length N,
* calculate a NxN matrix 'B' such that the value of a cell B(i,j) is the
* sum of A(i)..A(j) forall i<=j.
*/
public class SumArray {
public static void main(String[] args) {
int[] a = new int[]{ 12, 3, 6, 2, 23, 44 };
int[][] b = makeArray(a);
@pcj
pcj / init.el
Last active September 30, 2017 03:53
;; Javascript macros
(fset 'javascript-jsdoc-comment
[?\C-a ?/ ?* ?* return ?* tab return ?* tab ?/ return up up ?\C-e ? ])
(fset 'javascript-jsdoc-param
[?\C-e ? ?@ ?p ?a ?r ?a ?m company-dummy-event ? ?\{ right ? ?k ? ?- ? ?d ?. left left left left left left left left])
(fset 'javascript-jsdoc-param-string
[return tab ?* ? ?@ ?p ?a ?r ?a ?m ? ?\{ ?s ?t ?r ?i ?n ?g company-dummy-event right ? ])
@pcj
pcj / WORKSPACE
Last active September 19, 2018 04:15
Loading io_grpc_grpc_java and rules_closure together without initial conflict.
http_archive(
name = "io_grpc_grpc_java",
urls = ["https://github.com/grpc/grpc-java/archive/v1.15.0.tar.gz"],
strip_prefix = "grpc-java-1.15.0",
sha256 = "8a131e773b1c9c0442e606b7fc85d7fc6739659281589d01bd917ceda218a1c7",
)
load("@//:buildozer_http_archive.bzl", "buildozer_http_archive")
@pcj
pcj / README.md
Last active October 27, 2018 18:49
Installing bazel 0.4.5 on Windows

Installing bazel 0.4.5 on Windows 10

  1. Read the steps in https://bazel.build/versions/master/docs/windows.html.
  2. Read the github issues bazelbuild/bazel#2431 and related bazelbuild/bazel#2449.
  3. May be useful to consult https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_configure.bzl.

Install Msys2

  1. Make sure you install the Feb 5 2016 Msys2 version from https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-x86_64-20160205.exe/download.
  2. The install path must be c:\tools\msys64 (hardcoded into bazel).