This file contains hidden or 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
" pants.vim - Pants build integration for Vim | |
" Maintainer: Eugene Ma <http://github.com/edma2/> | |
" Version: 0.1 | |
function! s:Pants(...) | |
let pants = findfile('pants', '.;') | |
if strlen(pants) == 0 | |
echoerr "pants not found" | |
return 1 | |
end |
This file contains hidden or 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
#!/usr/bin/env lein exec | |
;; formats Clojure code from stdin, and prints formatted code to stdout | |
(require 'leiningen.exec) | |
;; Add a dependency to the classpath on the fly | |
(leiningen.exec/deps '[[cljfmt "0.1.7"]]) | |
(require '[cljfmt.core :as cljfmt]) |
This file contains hidden or 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
#!/usr/local/plan9/bin/rc | |
# Given a list of tags, plumb the corresponding file:line to edit. | |
if(test $#* -lt 1) { | |
echo 'usage: '$0' tag [-f tagfile] [tag...]' >[1=2] | |
exit usage | |
} | |
flagfmt='f tagfile' |
This file contains hidden or 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
--langdef=scala | |
--langmap=scala:.scala | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\4/c,classes/ | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*object[ \t]+([a-zA-Z0-9_]+)/\4/c,objects/ | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*case class[ \t]+([a-zA-Z0-9_]+)/\4/c,case classes/ | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*case object[ \t]+([a-zA-Z0-9_]+)/\4/c,case objects/ | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\4/t,traits/ | |
--regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/ | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*def[ \t]+([a-zA-Z0-9_]+)/\3/m,methods/ | |
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*val[ \t]+([a-zA-Z0-9_]+)/\3/l,constants/ |
This file contains hidden or 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 <elf.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
Elf32_Ehdr Elf_Header; | |
Elf32_Shdr Section_Header; | |
/** | |
* Load the ELF header. |
This file contains hidden or 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 <assert.h> | |
#define START_SIZE 10 | |
#define GROWTH_FACTOR 1.5 | |
typedef struct { | |
int size; /* total available size */ | |
int count; /* number of elements */ |
This file contains hidden or 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
/* Conway's Game of Life | |
* Author: Eugene Ma (edma2) */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define for_each_cell(g) \ | |
do { \ | |
int x, y; \ | |
for (y = 0; y < g->h; y++) { \ |
This file contains hidden or 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 <stdint.h> | |
#include <stdlib.h> | |
#include <png.h> | |
/* The boundaries of the plot */ | |
#define RE_MAX 1.0 | |
#define RE_MIN -2.0 | |
#define IM_MAX 1.0 |
This file contains hidden or 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
import java.awt.image.BufferedImage | |
import javax.imageio.ImageIO | |
import java.io.File | |
/** The Mandelbrot image with given width and height in pixels. */ | |
class Mandelbrot(width: Int, height: Int) { | |
case class Complex(re: Double, im: Double) { | |
def *(op: Complex): Complex = { | |
Complex(re * op.re - im * op.im, re * op.im + im * op.re) | |
} |
This file contains hidden or 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> | |
#define EVEN(x) ((x % 2) == 0) | |
static char *base32_encoder = "0123456789bcdefghjkmnpqrstuvwxyz"; | |
typedef struct { | |
double current_guess; | |
double error_margin; | |
double real_value; |
NewerOlder