This is a collection of information on PostgreSQL and PostGIS for what I tend to use most often.
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{minimal} | |
\usepackage{siunitx} | |
\usepackage[sc]{mathpazo} | |
\linespread{1.05} % Palatino needs more leading (space between lines) | |
\usepackage[T1]{fontenc} | |
\begin{document} | |
who wins? | |
\si{\micro\gram\per\liter} vs. $\mu$g/L | |
\end{document} |
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's say you have an R object that you'd like to share with someone else | |
# but, for whatever reason, it is necessary to share it in text form. | |
# Generate a random data.frame | |
set.seed(1337) | |
NN <- 10 | |
theData <- data.frame(Alpha = rnorm(NN), | |
Beta = rnorm(NN)) | |
theData$Gamma <- theData$Alpha * 2 + theData$Beta / 2 + rnorm(NN) | |
print(theData) |
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
doInstall <- TRUE | |
toInstall <- c("zoo") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
ftseIndex <- EuStockMarkets[, 4] | |
plot(ftseIndex, col = "GRAY") | |
# Calculate 10-day rolling mean, quickly: | |
smoothIndex <- rollmean(x = ftseIndex, # original series |
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(shiny) | |
library(dplyr) | |
library(lubridate) | |
# Load libraries and functions needed to create SQLite databases. | |
library(RSQLite) | |
library(RSQLite.extfuns) | |
saveSQLite <- function(data, name){ | |
path <- dplyr:::db_location(filename=paste0(name, ".sqlite")) |
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
catDf <- data.frame(meow = rnorm(100), purr = rpois(100, 3)) | |
aList <- list(aVector = 1:20, aDf = catDf, anotherList = list(1:200, 1:20)) | |
# annoying as hell, right? | |
head(aList) | |
#' Return the first or last part of a list | |
#' | |
#' Returns the first or last part of a list. Instead of returning the first | |
#' n entries as the standard head() does, it attempts to call head() |
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
# convert c("female", "Male") to c(0,1) | |
# magrittr is way nicer than nested function calls | |
convert_sexcodes <- | |
function(codes) | |
{ | |
require(magrittr) | |
tolower(codes) %>% |
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
# Resulting video from this code can be seen here: | |
# http://www.ifweassume.com/2015/02/world-population-density.html | |
# or | |
# https://vimeo.com/120308257 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.basemap import Basemap | |
import os |
The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.
I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.
Updated: Just use qutebrowser (and disable javascript). The web is done for.
OlderNewer