Skip to content

Instantly share code, notes, and snippets.

View ivyleavedtoadflax's full-sized avatar
🥘

Matt Upson ivyleavedtoadflax

🥘
View GitHub Profile
@ivyleavedtoadflax
ivyleavedtoadflax / .bash_profile
Created November 13, 2016 21:07
Make the OSX terminal behave like it should!!!
#export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
# Shorten and colour command prompt
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u:\W\$ '
fi
@ivyleavedtoadflax
ivyleavedtoadflax / .bash_profile
Created November 28, 2016 11:41
Make OSX terminal behave a little better
#export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
# Shorten and colour command prompt
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u:\W\$ '
fi
@ivyleavedtoadflax
ivyleavedtoadflax / .zshrc
Last active December 22, 2016 16:03
Zsh config file (includes fix for vim colours)
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/matthewupson/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@ivyleavedtoadflax
ivyleavedtoadflax / .tmux.conf
Last active December 4, 2019 12:05
tmux configuration
# Set prefix to capslock
set -g prefix C-b
# Set defaults
set -s escape-time 1
set -g base-index 1
setw -g pane-base-index 1
@ivyleavedtoadflax
ivyleavedtoadflax / eesectors.yml
Created February 13, 2017 14:24
tmuxinator config for eesectors project
# ~/.tmuxinator/eesectors.yml
name: eesectors
root: ~/Remote_documents/eesectors/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
@ivyleavedtoadflax
ivyleavedtoadflax / priority.sql
Created April 19, 2017 12:07
Alternative priority using string_agg instead of array_agg.
/*
---
name: Priority View
filename: priority.sql
logic:
- Join the classfied with the raw table and count total of each code
applied to each survey (respondent_id) to give the codes_join cte.
- Calculate the total number of codes applied to each survey to give
total_codes cte.
- Join these two ctes and calculate the ratio codes applied:
@ivyleavedtoadflax
ivyleavedtoadflax / methods.py
Created July 25, 2017 23:50
Different types of python method
class Date(object):
def __init__(self, day=0, month=0, year=0):
self.day = day
self.month = month
self.year = year
def print(self):
return self.day, self.month, self.year
@ivyleavedtoadflax
ivyleavedtoadflax / xml2-fix.md
Last active September 11, 2017 12:22
What to do when installing R package xml2 fails on OS X El Capitan
  • Download the latest binary of the xml2 package from here: https://cran.r-project.org/web/packages/xml2/index.html, you want: OS X El Capitan binaries: r-release: xml2_1.1.1.tgz (or similar).
  • Extract to a local dir with tar -xvf xml2_1.1.1.tgz.
  • Find where libxml2 is installed (or install with brew install libxml2), mine is /usr/local/Cellar/libxml2/2.9.4_3.
  • Set environment variable export LIBXML_INCDIR=/usr/local/Cellar/libxml2/2.9.5 using the path from above.
  • Install to the appropriate library: R CMD INSTALL -l ~/Documents/OMSQ_RAP/packrat/lib/x86_64-apple-darwin15.6.0/3.4.1/ .. Note that this installs into a packrat library, if you just want a system install do: R CMD INSTALL .

et voila!

UPDATE: This works for installing xml2, but it doesn't seem to work as a dependency for other packages that require it.

Keybase proof

I hereby claim:

  • I am ivyleavedtoadflax on github.
  • I am mattupson (https://keybase.io/mattupson) on keybase.
  • I have a public key ASCaaJ_dwu6Lb-DvQqk-EtxJv4TfHgD1ETYiE0XhpydneQo

To claim this, I am signing this object:

extract_GVA <- function(x) {
df <- data.frame(col1 = x)
if (!identical(1:5, df$col1)) stop("GVA data not 1 to 5")
structure(
df,
class = c("GVA", "data.frame"))
}
GVA <- extract_GVA(1:4) #throws error if data incorrect
GVA <- extract_GVA(1:5) #creates dataframe with GVA class that appears in