Skip to content

Instantly share code, notes, and snippets.

View danluu's full-sized avatar

Dan Luu danluu

  • https://danluu.com
  • Vancouver, BC
View GitHub Profile
@drio
drio / tmux libevent
Created August 18, 2010 22:03
How to compile tmux
NOTE: I am using bash for this.
NOTE2: Another approach for getting tmux would be to use gentoo-prefix or netbsd's pkgsrc. I
didn't have too much luck with gentoo-prefix. NetBSD was pretty straight forward but it had
an old version of tmux (1.1).
Here is how to get tmux compiled if you can get your systadmins to installed it ... or
any other weird reason. I assume you have some basic libraries and headers installed (like
ncurses, etc...). If not, you'll have to compile those ones too.
@benjchristensen
benjchristensen / index.html
Created May 2, 2012 19:34
Simple Line Graph using SVG and d3.js
<html>
<head>
<title>Simple Line Graph using SVG and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@louischatriot
louischatriot / gist:2601571
Created May 5, 2012 11:02
d3 introduction: animated graph in 11 LOC
<!DOCTYPE html>
<html manifest="cache.manifest">
<head> <title>d3 example</title> </head>
<body>
<div id='d3TutoGraphContainer'></div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script>
@tqbf
tqbf / gist:3132713
Created July 17, 2012 22:58
Crypto syllabus #1
0e3647e8592d35514a081243582536ed3de6734059001e3f535ce6271032
334b041de124f73c18011a50e608097ac308ecee501337ec3e100854201d
40e127f51c10031d0133590b1e490f3514e05a54143d08222c2a4071e351
45440b171d5c1b21342e021c3a0eee7373215c4024f0eb733cf006e2040c
22015e420b07ef21164d5935e82338452f42282c1836e42536284c450de3
043b452e0268e7eb005a080b360f0642e6e342005217ef04a42f3e43113d
581e0829214202063d70030845e5301f5a5212ed0818e22f120b211b171b
ea0b342957394717132307133f143a1357e9ed1f5023034147465c052616
0c300b355c2051373a051851ee154a023723414c023a08171e1b4f17595e
550c3e13e80246320b0bec09362542243be42d1d5d060e203e1a0c66ef48
@bradfitz
bradfitz / diskchecker.pl
Created July 24, 2012 21:05
diskchecker.pl
#!/usr/bin/perl
#
# Brad's el-ghetto do-our-storage-stacks-lie?-script
#
sub usage {
die <<'END';
Usage: diskchecker.pl -s <server[:port]> verify <file>
diskchecker.pl -s <server[:port]> create <file> <size_in_MB>
diskchecker.pl -l [port]
# time
# ====
macro time(ex)
quote
local t0 = time_ns()
local val = $(esc(ex))
local t1 = time_ns()
println("elapsed time: ", (t1-t0)/1e9, " seconds")
val
// On my system:
// virtual call time: 4.340
// non-virtual call time: 3.970
// virtual call overhead 9.32%
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#define NOINLINE __attribute__ ((noinline))

Some coding exercises, working up to matching regular expressions with Thompson's algorithm.

I'm assuming you know what a regular expression is and you're a fairly experienced programmer. I don't know if these exercises are either fun or effective -- please comment or fork here or email withal@gmail.com to help me improve them.

The problems

@staticfloat
staticfloat / debugging.md
Last active February 24, 2017 03:11
Julia Debugging Procedures

Julia Debugging Procedures

So you managed to break Julia. Congratulations! Collected here are some general procedures you can undergo for common symptoms encountered when something goes awry. Including the information from these debugging steps can greatly help the maintainers when tracking down a segfault or trying to figure out why your script is running slower than expected.

If you've been directed to this page, find the symptom that best matches what you're experiencing and follow the instructions to generate the debugging information requested. Table of symptoms:

# using VirtualBox version $VBOX_VERSION
FROM boot2docker/boot2docker
RUN apt-get install p7zip-full
RUN mkdir -p /vboxguest && \
cd /vboxguest && \
curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso && \
7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \
sh VBoxLinuxAdditions.run --noexec --target . && \