This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class lazy(object): | |
'''A simple lazy evaluation hack, with just enough magic to be | |
useful for passing as a value to a Django template. | |
Creates a lazy wrapper around a function call, when used as | |
lazy(function, argument_1, argument_2, ...) | |
The resulting object is callable, and calling it (with no arguments) will | |
evaluate the function on the arguments passed to the constructor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/jamisbuck-mazes.css b/jamisbuck-mazes.css | |
index dfbcc74..021bb07 100644 | |
--- a/jamisbuck-mazes.css | |
+++ b/jamisbuck-mazes.css | |
@@ -1,6 +1,7 @@ | |
.row .maze { | |
padding: 0 0 20px 20px; | |
display: inline-block; | |
+ float: left; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <bitstring.h> | |
#define ROWS 10 | |
#define COLS 10 | |
#define REPETITIONS 100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Claim: | |
Let p be an odd prime number. Then the following are equivalent: | |
1. p is congruent to 1 modulo 4. | |
2. There is some natural number m such that m^2 + 1 is a multiple of p. | |
3. p is the sum of two squares. | |
Proof: | |
We'll prove (1) => (2) => (3) => (1). | |
(1) => (2): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# An implementation of a "weave" maze generator. Weave mazes are those | |
# with passages that pass both over and under other passages. The | |
# technique used in this program was described to me by Robin Houston, | |
# and works by first decorating the blank grid with the over/under | |
# crossings, and then using Kruskal's algorithm to fill out the rest | |
# of the grid. (Kruskal's is very well-suited to this approach, since | |
# it treats the cells as separate sets and joins them together.) | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# An implementation of a "weave" maze generator. Weave mazes are those | |
# with passages that pass both over and under other passages. The | |
# technique used in this program was described to me by Robin Houston, | |
# and works by first decorating the blank grid with the over/under | |
# crossings, and then using Kruskal's algorithm to fill out the rest | |
# of the grid. (Kruskal's is very well-suited to this approach, since | |
# it treats the cells as separate sets and joins them together.) | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# An implementation of a "weave" maze generator. Weave mazes are those | |
# with passages that pass both over and under other passages. The | |
# technique used in this program was described to me by Robin Houston, | |
# and works by first decorating the blank grid with the over/under | |
# crossings, and then using Kruskal's algorithm to fill out the rest | |
# of the grid. (Kruskal's is very well-suited to this approach, since | |
# it treats the cells as separate sets and joins them together.) | |
# -------------------------------------------------------------------- | |
# NOTE: the display routine used in this script requires a terminal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4348185993527971140017754520398792366355808508676369850004915590441515060661458214667271203405019575007937468618354879584126414115622907799010209410194060155763807332972544002600803547428612058593806723314691537293887419566771681773973016641642557685645872104195753846396561349133892834378686436032925880542575024982094923217710612953406379201045370345111301343985397095508233901911555264362787557919955846033904145666162595951456444981742264974724173395158329414086432210250028891231956057268516907166394749027193595719252124921854939764725014658326169554924542997881136168534925459265515269659850925843178492329893757907908230630057047521879846065830206978615485164793242410538316804472808579196300071246922262120752228040393672596623557011763561488379710009128991119445972016475352736660460999856196775245526944884160325405002697972910947062088775578668133757691459205541343939705987191082605925723724548099172259647609090685388774209266195057003299130195362122357674198263030277753668640207958774787392133399140333605494 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2011-08-11T23:00:01 244 | |
2011-08-12T01:00:01 249 | |
2011-08-12T03:00:02 249 | |
2011-08-12T05:00:01 249 | |
2011-08-12T07:00:01 250 | |
2011-08-12T09:00:02 260 | |
2011-08-12T11:00:01 276 | |
2011-08-12T13:00:01 295 | |
2011-08-12T15:00:01 316 | |
2011-08-12T17:00:02 495 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
merge = (start, len1, len2) -> | |
# merge the slice [start, start+len1) with the slice [start+len1, start+len2) | |
i = start; j = start+len1 | |
while i < j and j < start+len2 | |
VA.insert(j++, i) if VA.lt(j, i) | |
i++ | |
mergesort = (start, len) -> | |
# sort the slice [start, start+len) | |
VA.highlight([start ... start+len]) |
OlderNewer