Skip to content

Instantly share code, notes, and snippets.

View joshbode's full-sized avatar

Josh Bode joshbode

  • Melbourne, Victoria, Australia
View GitHub Profile
TARGET := embed
CC := clang
SHELL := /bin/bash
FRAMEWORK_PATH ?= /Library/Frameworks
$(TARGET): $(TARGET).c
@$(CC) -o $(TARGET) $(TARGET).c -lR \
-L$(FRAMEWORK_PATH)/R.framework/Libraries \
-I$(FRAMEWORK_PATH)/R.framework/Headers

SQL Hashing

Database Mapper Reducer
Oracle `ORA_HASH(x
SQL Server CHECKSUM(x, y, ...) CHECKSUM_AGG(...)
Teradata HASHBUCKET(HASHROW(x, y, ...)) SUM(...)
" directories
set browsedir=buffer
set wildignore=*.o,*.pyc
set wildmode=list:longest,list:full
if v:version >=# '704'
set wildignorecase
endif
set autochdir
" persistence
@joshbode
joshbode / py_aliases.zsh
Last active April 17, 2016 16:42
Interactive ZSH wrapper/alias for versioned Python commands to select version when no version provided (e.g. ipython -> ipython2 or ipython3)
_py_version() {
PY_VERSIONS=(2 3)
LINE=(${(s: :)history[$HISTCMD]})
COMMAND=${LINE[1]}
ARGS=${(j: :)LINE[2,-1]}
while (( 1 )) {
read -s -k1 VERSION"?$COMMAND [${PY_VERSIONS[1]}]: "
if [[ $VERSION == $'\n' ]]; then
@joshbode
joshbode / dn.html
Last active March 18, 2016 05:02
Collate transcripts from Democracy Now into a single document.
<!DOCTYPE html>
<html>
<head>
<title>Democracy Now Transcript: {{ date }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
body {
margin: auto;
#! /usr/bin/env bash
GREP=ggrep
# parameters
BAND=$1
CHANNEL=${2:-0}
# determine the router ip
ROUTER=$(netstat -nr | $GREP -oP '(?<=^default) +[^ ]+' | $GREP -oP '[^ ]+')
for V in 2 3; do
pip${V} install --upgrade six https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py${V}-none-any.whl
done
@joshbode
joshbode / numbered_headings.md
Last active April 3, 2020 07:46
Numbered Headings in Markdown via CSS

World

Country

State

City

Suburb
Street
<style type="text/css"> body { margin: auto;
def subset(elements):
"""Generate subsets."""
if not elements:
yield []
return
head = elements[0]
for tail in subset(elements[1:]):
yield tail
@joshbode
joshbode / subset.py
Last active November 14, 2015 17:32
def subset(head, tail=None):
"""Generate subsets."""
if not head:
return
if tail is None:
tail = []
yield []