Skip to content

Instantly share code, notes, and snippets.

View jesboat's full-sized avatar

Jade Sailor jesboat

  • Boston, MA
View GitHub Profile
@jesboat
jesboat / friends.pl
Created February 19, 2013 07:29
A quick hack to Graphviz-ify your Facebook friends.
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
use JSON::Syck qw(Load Dump);
use DB_File;
my $URL = 'https://graph.facebook.com/%s?method=GET&format=json&access_token=XYZ';
@jesboat
jesboat / rev.cpp
Created February 3, 2013 18:22
Reversing a singly linked list in O(n) time with a single extra node reference.
#include <vector>
#include <ostream>
#include <iostream>
#include <string>
#include <cstdlib>
struct Node {
Node *next;
int val;
Node(Node *n, int v) : next(n), val(v) { }
#!/usr/bin/perl
use strict;
use warnings;
{
package Base;
sub scan_stash {
my ($for, $stash, $seen) = @_;
if (my $glob = $stash->{$for}) {
@jesboat
jesboat / chrome-bug.html
Created August 19, 2012 03:22
This exhibits a bug in Chrome's JS engine
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title>Rawr</title>
<p>JS follows
<pre>
<script type="text/javascript">
function wr(str) {
document.write(str + "<br>");
}
var a = {valueOf: function(x) { wr("a"); return 1; }};
var b = {valueOf: function(x) { wr("b"); return 2; }};
@jesboat
jesboat / gist:2728469
Created May 19, 2012 01:17
Packet trace for ServerFault question http://serverfault.com/questions/390558
No. Time Source Destination Protocol Length Info
1 0.000000 10.116.254.17 10.116.254.1 NFS 172 V3 GETATTR Call (Reply In 2), FH:0xbec98b1c
Frame 1: 172 bytes on wire (1376 bits), 172 bytes captured (1376 bits)
Internet Protocol Version 4, Src: 10.116.254.17 (10.116.254.17), Dst: 10.116.254.1 (10.116.254.1)
Transmission Control Protocol, Src Port: 798 (798), Dst Port: nfs (2049), Seq: 1, Ack: 1, Len: 120
Remote Procedure Call, Type:Call XID:0x2f8a18a9
Fragment header: Last fragment, 116 bytes
1... .... .... .... .... .... .... .... = Last Fragment: Yes
.000 0000 0000 0000 0000 0000 0111 0100 = Fragment Length: 116
.^
' |
|
|
--+--
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<svg width="30cm" height="9cm" viewBox="0 0 1000 300" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- show outline of canvas -->
<rect x="1" y="1" width="998" height="298"
fill="none" stroke="red" stroke-width="2"/>
<path d="M 0 150 L 1000 150" stroke="red" stroke-width="1"/>
<path d="M 500 0 L 500 300" stroke="red" stroke-width="1"/>
#define EXIT_STATUS EXIT_FAILURE
#include "true.c"
Timing multiple value return techniques
running automated test.
noMultipleValues time 4131
noMultipleValues time 4133
noMultipleValues time 4128
noMultipleValues time 4204
noMultipleValues time 4122
noMultipleValues time 4121