Skip to content

Instantly share code, notes, and snippets.

*.o
rpsls
*.db
@skeeto
skeeto / Makefile
Last active August 29, 2015 14:07
Sorted Stack (dailyprogrammer)
CFLAGS = -std=c99 -Wall -g3
main : main.o sstack.o
main.o : main.c sstack.h
sstack.o : sstack.c sstack.h dlist.h
run : main
./$^
@skeeto
skeeto / thebutton.el
Last active August 29, 2015 14:18
thebutton-mode
;;; thebutton.el --- display r/thebutton's status on the modeline
;; This is free and unencumbered software released into the public domain.
;;; Commentary:
;; Unfortunately the URL's hash changes regularly, so you may need to
;; update `thebutton-url' to the new when first start the mode.
;; Dependency: https://github.com/ahyatt/emacs-websocket
@skeeto
skeeto / A072841.c
Created August 14, 2015 16:45
A072841
/* https://oeis.org/A072841
* This is free and unencumbered software released into the public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define MAX(a, b) ((b) > (a) ? (b) : (a))
@skeeto
skeeto / collatz.c
Created June 2, 2011 20:45
Collatz experiment
#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)
@skeeto
skeeto / .gitignore
Created May 10, 2012 01:29
JFreeChart demo
build
dist
cache.properties
TAGS
@skeeto
skeeto / maxima.c
Created July 28, 2012 02:07
Compute local maxima using Newton's method
#include <stdio.h>
#include <math.h>
#include <float.h>
#define N 3
typedef struct {
double x[N];
} vector;
@skeeto
skeeto / .gitignore
Created August 11, 2012 04:34
Hendecagon
*.svg
*.txt
*.gif
@skeeto
skeeto / with-alist-access.el
Last active October 9, 2015 10:05
A better alist macro
;;; with-alist-access.el --- a better alist macro
;; This is free and unencumbered software released into the public domain.
;;; Commentary:
;; Usage example:
;; (let ((student '((id . 1332412)
;; (name . ((first . "Student")
@skeeto
skeeto / minesweeper.js
Created November 4, 2012 03:49
Minesweeper Game
function Minefield(width, height, mines) {
this.width = width;
this.height = height;
this.grid = Minefield.make2dArray(width, height, 0);
this.seen = Minefield.make2dArray(width, height, false);
this.marked = Minefield.make2dArray(width, height, false);
var rand = function(n) {
return Math.floor(Math.random() * n);
};
while(mines > 0) {