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
Quote from _At Day's Close: Night in Times Past Paperback_ (A. Roger Ekirch, 2006). | |
Courtiers took the place of knights, satin and silk replaced chain | |
mail. The growing power of nation states, marked by their | |
monopolization of military force, only broadened the scope of | |
this transformation. Well-understood rules of civility governed | |
social exchanges among friends and strangers. Hence, it was thought | |
inappropriate, if walking on a street, to ask questions of a stranger | |
or to touch, much less jostle, other pedestrians. Above all, persons | |
of quality required respect, lest their dignity be affronted. Besides |
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
{-# LANGUAGE FlexibleInstances #-} | |
-- Airports for Blinco! | |
module Airports where | |
import Control.Monad (forM_) | |
airportsRaw :: [String] | |
airportsRaw = [ "BNE", "SYD", "ADL", "PER", "CNB", "NTL", "UDG", "CTL" |
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
{-# LANGUAGE OverloadedStrings #-} | |
module TestWithHsJWT where | |
import qualified Data.Text as T | |
import qualified Crypto.JWT as JWT | |
import qualified Crypto.JOSE as JOSE | |
import qualified Data.HashMap.Lazy as HM | |
import Data.Aeson |
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 | |
from functools import partial | |
import sys | |
BLOCKSIZE = 1048576 | |
# Similar to http://bugs.python.org/issue20992 | |
# but with Python 2.x syntax. | |
def read_blocks(files): |
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 AddProjToBruker where | |
-- ##$SUBJECT_comment=( 2048 ) | |
-- <CAI:10001> | |
import Control.Monad (when) | |
import Data.Either | |
import Data.List | |
import Data.Maybe | |
import System.Environment |
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 date-example | |
(:import java.util.Date) | |
(:import java.text.DateFormat)) | |
(def df (DateFormat/getDateInstance)) | |
; Simon's bit | |
(defn weekdays-in-range [start-date end-date] | |
(let [one-day (* 1000 60 60 24) ; millisecs |
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://carlo-hamalainen.net/blog/2011/08/04/ggplot2-from-clojure | |
; To dump the plot to a file: | |
(use '(com.evocomputing rincanter)) ; https://github.com/jolby/rincanter | |
(r-eval "library(ggplot2)") | |
(r-eval-raw "qplot(rating, data=movies, geom=\"histogram\")") ; see http://had.co.nz/ggplot2/geom_histogram.html | |
(r-eval "ggsave('histogram-example.png')") | |
; To display on your screen (Unix example; see rincanter docs for alternatives to x11() call) | |
(use '(com.evocomputing rincanter)) |
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 testing-netcdf | |
(:import ucar.ma2.Array) | |
(:import ucar.ma2.ArrayDouble) | |
(:import ucar.ma2.ArrayDouble$D2)) | |
(def a (Array/factory Double/TYPE (int-array [2 2]))) | |
(println (type a)) ; ucar.ma2.ArrayDouble$D2 | |
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
ncInq :: NCID -> IO (Int, Int, Int, Int) | |
ncInq ncid = do | |
alloca $ \ndims_ptr -> do | |
alloca $ \nvars_ptr -> do | |
alloca $ \natts_ptr -> do | |
alloca $ \unlimdimid_ptr -> do | |
status <- nc_inq ncid ndims_ptr nvars_ptr natts_ptr unlimdimid_ptr | |
ndims <- peek ndims_ptr | |
nvars <- peek nvars_ptr | |
natts <- peek natts_ptr |
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
(defun blerp (x y) | |
"A closure that provides a linear interpolation of a function y = f(x). Attempts to evaluate f | |
at values of x below the minimum value of x result in zero, and attempts above the maximum | |
value of x result in the last value of y." | |
(assert (vectorp x)) | |
(assert (vectorp y)) | |
(let ((min-x (aref x 0)) | |
(max-x (aref x (1- (length x)))) | |
(interp-f (cl-numlib:make-interpolating-function x y))) | |
(lambda (x) |
OlderNewer