Markup Cheat sheet for Org-mode
Heading 1
Heading 2: Set a deadline and a schedule
[66%] Heading 3: a list with checkboxes
- [X] task 1
- [X] task 2
- [ ] task 3
function sitegen | |
cd /home/public | |
rm *.html | |
cd /home/public/posts | |
set posts (ls) | |
ser webdir /home/public | |
set header $webdir/conf/header.html | |
set footer $webdir/conf/footer.html | |
for post in $posts | |
if test (echo $post | sed "s/.*\.//") = md |
pattern = """ | |
\b # new word boundary | |
NCC # Match NCC | |
( ?-? ?) # Match '-' | |
([0-9][0-9]+) # Match registry number | |
( ?-? ?) # Match optional '-' | |
([A-Z]?) # Match optional suffix | |
\b # end word boundary | |
""" |
#lang racket | |
(provide | |
(contract-out | |
[make-coinage (-> (listof positive-integer?) list?)])) | |
(define (positive-integer? x) | |
(and (positive? x) | |
(integer? x))) |
require("clicks-in-new-buffer.js"); | |
require("page-modes/google-search-results.js"); | |
require("page-modes/wikipedia.js"); | |
require("session.js"); | |
require("block-content-focus-change.js"); | |
require("favicon"); | |
require("content-policy.js"); | |
require("index-webjump.js"); | |
xkcd_add_title = true; |
#' Clever chunking algorithm into roughly equal parts | |
#' http://stackoverflow.com/questions/2130016/splitting-a-list-of-arbitrary-size-into-only-roughly-n-equal-parts | |
chunk <- function(x, k) { | |
n <- length(x) | |
q <- n %/% k | |
r <- n %% k | |
lapply(seq.int(1, k), function(i) { | |
x[seq(from = (i - 1)*q + min(i - 1, r) + 1, to = i * q + min(i, r))] | |
}) | |
} |
#' My function for doing cross validation (creating the splits before hand) | |
xvalidate <- function(f, formula, data, bin, ...) { | |
fold <- length(bin) | |
xs <- seq.int(1, fold) | |
lapply(xs, function(x) { | |
train <- data[unlist(bin[-x]),] | |
test <- data[bin[[x]],] | |
model <- f(formula, data = train, ...) |
on_circle_iter <- function(theta) { | |
if(theta < 2*pi) theta else on_circle(theta - 2*pi) | |
} | |
on_circle <- function(theta) Vectorize(on_circle_iter, SIMPLIFY = FALSE) | |
all(on_circle(pi*seq(0, 8, by = 2) == 0) |
# all.equal does a lot, nearly_equal does little. | |
nearly_equal <- function(x, y, tol = sqrt(.Machine$double.eps)) y < x + tol & y > x - tol | |
# syntax can be confusing to beginners | |
which_is <- function(x, test) x[which(test)] | |
x <- seq(0, 2*pi, by = 0.01) | |
library(magrittr) | |
x %>% which_is(nearly_equal(sin(x), 0.5, tol = 0.005)) |
#!/usr/bin/env racket | |
#lang racket/base | |
(require racket/vector) | |
;; Capture the command line args sent to this script | |
(define args | |
(current-command-line-arguments)) | |