View postgres_binning.sql
with example as ( | |
select 399 as num, width_bucket(399, 400, 990, 59) as buk | |
union all | |
select 400 as num, width_bucket(400, 400, 990, 59) as buk | |
union all | |
select 401 as num, width_bucket(401, 400, 990, 59) as buk | |
union all | |
select 409 as num, width_bucket(409, 400, 990, 59) as buk | |
union all | |
select 410 as num, width_bucket(410, 400, 990, 59) as buk |
View boilerplate.py
# -*- coding: utf-8 -*- | |
""" TODO: Update package docstring | |
""" | |
import logging | |
import argparse | |
def str2bool(val): | |
""" string to boolean conversion for argparse |
View gist:c896b77a51168ebb8338ee78740180d8
Install-Module -Name PowerShellCookbook | |
$app = Get-InstalledSoftware | Where-Object { $_.Publisher -like '*Anaconda*' } | |
$app.UninstallString |
View install_tex_packages.sh
export TEXLIB=/usr/share/texlive/texmf-dist/ | |
export packagename=tabu | |
wget http://mirrors.ctan.org/macros/latex/contrib/$packagename.zip | |
unzip $packagename.zip | |
cd $packagename | |
latex *.ins | |
sudo mkdir $TEXLIB/tex/latex/$packagename | |
sudo cp *.sty $TEXLIB/tex/latex/$packagename | |
cd .. |
View RSetup.R
# To get setup quickly just run the below line: | |
# (note that it changes with revisions to the file... will try to keep it up to date) | |
# source('https://gist.githubusercontent.com/logworthy/695f037e79ca4a2c49f2bdbe3502a0c5/raw/459be6d79c7e2762cae9b5c981a18dfde24da4ba/RSetup.R') | |
# set up R with desired pacakges and load them by default | |
# install packages | |
packages_required <- c( | |
'data.table', | |
'RODBC', |
View linear programming example
/***** | |
EXAMPLE OF A LINEAR PROGRAMMING PROBLEM | |
*****/ | |
/* classes of things */ | |
set CATEGORIES; | |
/* function discretised over these points */ | |
set POINTS; |
View Logistic Simulations
# Simulation of how simple logistic regression can fail to model | |
# binomial response when the underlying function is more complicated | |
install.packages(c('data.table', 'plyr', 'ggplot2', 'drc')) | |
library(data.table) | |
library(plyr) | |
library(ggplot2) | |
library(drc) | |
# Generalised logistic function | |
logistic_function <- function(x) { |
View parking event copying
create table parking_events ( | |
id integer, | |
areaname text, | |
streetname text, | |
betweenstreet1 text, | |
betweenstreet2 text, | |
sideofstreet text, | |
streetmarker text, | |
arrivaltime timestamp, |