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
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/ | |
create or replace function uuid_generate_v7() | |
returns uuid | |
as $$ | |
begin | |
-- use random v4 uuid as starting point (which has the same variant we need) | |
-- then overlay timestamp | |
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string | |
return encode( |
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 sys, requests | |
# Usage: Pass URL to script, get back URL to Wayback Machine snapshot | |
base_url = 'http://web.archive.org' | |
r = requests.get(base_url + '/save/' + sys.argv[1]) | |
if r.status_code == requests.codes.ok: |
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
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=OUTPUT.pdf INPUT.pdf |
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
iconv -t UTF8 -f MACROMAN < file.csv > file-utf8.csv |
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
# let x be John's age (but I don't know what it is) | |
x <- NA | |
# let y be Mary's age (but I don't know what it is) | |
y <- NA | |
# are Mary and John the same age? | |
x == y |
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
# Obtain the label of a given class (:class1). | |
SELECT DISTINCT ?c (STR(?l) AS ?lb) | |
WHERE { | |
?c a :class1 ; | |
<http://www.w3.org/2000/01/rdf-schema#label> ?l . | |
} | |
# Obtain a list of classes. | |
SELECT DISTINCT ?c | |
WHERE { |
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
library(httr) | |
library(XML) | |
library(selectr) | |
xpath <- function(x) structure(x, class = "xpath") | |
sel <- function(x) xpath(css_to_xpath(x, prefix = "//")) | |
url <- "http://www.boxofficemojo.com/movies/?id=ateam.htm" | |
html <- content(GET(url), "parsed") |
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
\documentclass[letter,$if(fontsize)$$fontsize$,$else$10pt,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{ucbletter} | |
\usepackage[T1]{fontenc} | |
\usepackage{mathpazo} | |
\usepackage{amssymb,amsmath} | |
\linespread{$if(linespread)$$linespread$$else$1.1$endif$} | |
\usepackage{ifxetex,ifluatex} | |
\usepackage{fixltx2e} % provides \textsubscript | |
% use upquote if available, for straight quotes in verbatim environments | |
\IfFileExists{upquote.sty}{\usepackage{upquote}}{} | |
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex |
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
notify <- function(msg="Operation complete") { | |
in.osx <- (Sys.info()['sysname'] == "Darwin") | |
in.rstudio <- (Sys.getenv("RSTUDIO") == "1") | |
in.rgui <- (Sys.getenv("R_GUI_APP_REVISION") != "") | |
if (in.rstudio) { # hack to see if running in RStudio | |
title <- "RStudio" | |
sender <- activate <- "org.rstudio.RStudio" | |
} |
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
```{r setup, echo=FALSE, results='hide'} | |
chunkref <- local({ | |
function(chunklabel) { | |
sprintf('[%s](#%s)', chunklabel, chunklabel ) | |
} | |
}) | |
secref <- local({ | |
function(seclabel) { | |
sprintf('[%s](#%s)', seclabel, seclabel ) |
NewerOlder