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
(ns com.caira.util.ringbuffer | |
(:import (clojure.lang Counted IPersistentCollection IPersistentVector | |
Indexed RT SeqIterator Seqable Util) | |
(java.util Collection List))) | |
(defn ^:private iterables-equiv? [^Iterable i1 ^Iterable i2] | |
(let [it1 (.iterator i1) | |
it2 (.iterator i2)] | |
(loop [] | |
(or (not (.hasNext it1)) |
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
module Bunrui.Core | |
( Command | |
, Metadata(..) | |
, Opts(..) | |
, findSourceFiles | |
, missingDirectories | |
, readMetadata | |
) where | |
import Control.Applicative ((<$>), (<*), (<*>)) |
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
bfs :: Tree a -> [a] | |
bfs t = | |
concatMap (map rootLabel) $ | |
takeWhile (not . null) $ | |
iterate (concatMap subForest) [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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>coordinate calculator</title> | |
<style>h1 { font-size: 1.1em; }</style> | |
</head> | |
<body> | |
<h1>Convert between degrees, minutes, and seconds and decimal degrees</h1> | |
<table id="calc"> |
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
module Main where | |
import System.Environment | |
runRPN :: (Fractional a, Read a) => String -> [a] | |
runRPN = foldl doToken [] . words | |
where doToken (x:y:zs) "+" = (y+x):zs | |
doToken (x:y:zs) "-" = (y-x):zs | |
doToken (x:y:zs) "*" = (y*x):zs | |
doToken (x:y:zs) "/" = (y/x):zs |
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
CPPFLAGS += -D_BSD_SOURCE -D_XOPEN_SOURCE=600 \ | |
-I/usr/local/include -Isrc | |
CXXFLAGS += -std=c++98 -fno-rtti -fno-exceptions -pipe \ | |
-Wall -Wextra -Werror -Wcast-align -Wstrict-overflow -Wshadow | |
LDFLAGS += -L/usr/local/lib | |
INSTALL ?= install | |
ifdef pkg_config_libs | |
CPPFLAGS += $(shell pkg-config --cflags $(pkg_config_libs)) |
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
BEGIN { OFS = "\t" } | |
{ | |
accs[0] += 1 | |
accs[1] += $1 | |
accs[2] += (val2 = $1 * $1) | |
accs[3] += (val3 = val2 * $1) | |
accs[4] += (val4 = val3 * $1) | |
mean = accs[1] / accs[0] |
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 <pthread.h> | |
pthread_mutex_t mutex; | |
// compile and link with: cc -c mutex.c; ld -dylib -o libmutex.dylib mutex.o -lpthread |
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
#!/usr/bin/env python | |
import os | |
import sys | |
import bisect | |
import shutil | |
import datetime | |
import operator | |
import subprocess |
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
#!/usr/bin/env python | |
import collections | |
import sys | |
def tokens(f): | |
for line in f: | |
for t in line.split(): | |
yield t |