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
log | |
pi | |
state | |
state~ |
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 <sys/time.h> | |
#include <gmp.h> | |
#define S(n) mpz_get_str(NULL, 10, n) | |
#define EQ(z, n) (mpz_cmp_ui(z, n) == 0) | |
/* Print out collatz path for given number. */ | |
int path(char *str) |
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
;; http://xahlee.blogspot.com/2011/11/emacs-lisp-exercise-latitude-longitude.html | |
(defun latitude-longitude-decimalize (str) | |
(destructuring-bind (lath latm lats latd lonh lonm lons lond) | |
(split-string str "[^0-9.NEWS]+" t) | |
(vector (latlon-helper latd lath latm lats) | |
(latlon-helper lond lonh lonm lons)))) | |
(defun latlon-helper (d &rest hms) | |
(* (if (or (equal d "N") (equal d "E")) 1 -1) |
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
## Returns the Perlin noise value for the given point. Accepts 2D | |
## arrays for x and y, i.e. from meshgrid(). For example, | |
## | |
## [x y] = meshgrid(0:0.1:10, 0:0.1:10); | |
## d = perlin(x, y); | |
## | |
## The special thing here is it's entirely vectorized: no loops! | |
function v = perlin(x, y) | |
## Find the nearest grid points (2D) | |
x0 = floor(x); |
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
build | |
dist | |
cache.properties | |
TAGS |
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
(add-to-list 'file-name-handler-alist '("\\.class$" . javap-handler)) | |
(defun javap-handler (op &rest args) | |
"Handle .class files by putting the output of javap in the buffer." | |
(cond | |
((eq op 'get-file-buffer) | |
(let ((file (car args))) | |
(with-current-buffer (create-file-buffer file) | |
(call-process "javap" nil (current-buffer) nil "-verbose" | |
"-classpath" (file-name-directory file) |
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 <math.h> | |
#include <float.h> | |
#define N 3 | |
typedef struct { | |
double x[N]; | |
} vector; |
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
galaxy | |
output.* | |
*.png |
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
;; Minimum Number Of Coin Tosses Such That Probability Of Getting 3 | |
;; Consecutive Heads Is Greater Than 1/2 | |
;; http://blog.eduflix.tv/2012/05/contest-answer-minimum-number-of-coin-tosses-such-that-probability-of-getting-3-consecutive-heads-is-greater-than-12/ | |
(require 'cl) | |
(defun flip () | |
"Flip a coin." | |
(if (< 0 (random)) 'H 'T)) |
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
sqrt2 | |
*.txt |
OlderNewer