Skip to content

Instantly share code, notes, and snippets.

@stephenmcgruer
stephenmcgruer / gist:858539
Created March 7, 2011 14:03
99 Bottles of Beer, the (Compiling Techniques version of) Small-C way.
// Welcome to hell... and the reason
// for the ability to embed variables
// in strings. Yes, this is effectively the
// same as just writing the damn thing out.
// And yes, I did generate this code - I'm not
// that insane.
outputBottleStatement(int numBottles) {
if (numBottles == 99) {
print("99 bottles of beer on the wall, 99 bottles of beer.");
@stephenmcgruer
stephenmcgruer / chrome-symlink.sh
Created October 1, 2011 17:34
Shell script to set up a symlink to tmp for google chrome's cache.
@stephenmcgruer
stephenmcgruer / prims.scala
Created May 24, 2013 16:26
A few hours of flicking through Scala tutorials, and this is my first non-copy-pasted Scala code outside of the interpreter. This is why I should just stick to Java... (Incidentally, I almost feel like I should apologise for the horrible implementation of Prim's. The focus was Scala learning, not decent code writing.)
class Node(id : Int) {
var edges = List[Edge]()
def addEdge(other : Node, weight : Int) = {
val edge = new Edge(this, other, weight)
edges = edge :: edges
edge
}
override def toString() = id.toString
<!-- Must be run with --js-flags="--expose-gc" -->
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test for Blink Reference Cycle crash</title>
<style>
.animate {
height: 100px;
width: 100px;
<style>
.scroller {
overflow: auto;
height: 100px;
width: 100px;
}
.rightToLeft {
direction: rtl;
}
$ rr record ./out/Default/content_shell --single-process http://www.google.com
rr: Saving execution to trace directory `/usr/local/google/home/smcgruer/.local/share/rr/content_shell-16'.
shared memfd open() failed: Function not implemented
DevTools listening on ws://127.0.0.1:46379/devtools/browser/35b61d5d-3479-4947-85c3-65e8a0082d86
[69544:69689:0328/111616.396185:ERROR:gl_context_glx.cc(187)] Failed to create GL context with glXCreateNewContext.
[69544:69689:0328/111616.399948:ERROR:gpu_info_collector.cc(64)] gl::init::CreateGLContext failed
[69544:69689:0328/111616.400724:ERROR:gpu_info_collector.cc(187)] Could not create context for info collection.
[69544:69689:0328/111620.497418:ERROR:gl_context_glx.cc(177)] Failed to create GL context with glXCreateContextAttribsARB.
[69544:69689:0328/111620.497754:ERROR:gpu_info_collector.cc(64)] gl::init::CreateGLContext failed
$ rr record ./out/Default/content_shell http://www.google.com
rr: Saving execution to trace directory `/usr/local/google/home/smcgruer/.local/share/rr/content_shell-17'.
shared memfd open() failed: Function not implemented
DevTools listening on ws://127.0.0.1:46311/devtools/browser/03f83acf-51dc-42e4-84c9-5c90586075eb
[70439:70439:0328/111826.606496:ERROR:gl_context_glx.cc(187)] Failed to create GL context with glXCreateNewContext.
[70439:70439:0328/111826.608135:ERROR:gpu_info_collector.cc(64)] gl::init::CreateGLContext failed
[70439:70439:0328/111826.608963:ERROR:gpu_info_collector.cc(187)] Could not create context for info collection.
[70439:70439:0328/111826.609822:ERROR:gpu_init.cc(62)] gpu::CollectGraphicsInfo failed.
[70439:70439:0328/111826.687492:WARNING:x11_util.cc(1422)] X error received: serial 183, error_code 2 (BadValue (integer parameter out of range for operation)), request_code 154, minor_code 24 (X_GLXCreateNewContext)
6462 testRunner.dumpAsText
3249 testRunner.waitUntilDone
3224 testRunner.notifyDone
2098 testRunner.log
2011 eventSender.mouseMoveTo
1730 eventSender.keyDown
1297 eventSender.mouseUp
1294 eventSender.mouseDown
644 internals.isPreloaded
556 testRunner.completeTest