Skip to content

Instantly share code, notes, and snippets.

$ brew upgrade rbenv
$ rbenv -v
rbenv 0.4.0
$ brew upgrade ruby-build
$ ruby-build --version
ruby-build 20130628
$ rbenv install --list | grep 2.0.0-p
2.0.0-p0
2.0.0-p195
2.0.0-p247
@marcionicolau
marcionicolau / pg_postgis_20_92.sh
Last active November 7, 2017 06:59 — forked from rolo/gist:1481128
Install Postgis-2.0 to PostgreSQL 9.2 Server on Ubuntu 12.04 Server
#!/bin/bash
#
# Install Postgres 9.2, PostGIS and create PostGIS template on an Ubuntu 12.04 Server
# add official postgresql.org ubuntu repos (http://wiki.postgresql.org/wiki/Apt)
# Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg.
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg2.list
# Import the repository key from http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc, update the package lists, and start installing packages:
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
#! /usr/bin/env Rscript
#start an instance
startup <- system("ec2-run-instances ami-b232d0db -k ec2ApiTools", intern=T)
Sys.sleep(45) #rather random but 45 seconds is typically long enough to boot
#query running instances
instances <- system("ec2-describe-instances", intern=T)
instancesParsed <- sapply(instances, strsplit, "\t")
<script src="https://github.com/livereload/livereload-js/raw/master/dist/livereload.js?host=localhost"></script>
@marcionicolau
marcionicolau / ace-shiny.css
Created January 16, 2013 12:22
knitr shiny example - by yihui
#proxy {
position: absolute;
top: 0;
right: 0;
display: none;
}
#notebook {
position: absolute;
width: 600px;
@marcionicolau
marcionicolau / instructR.R
Created January 16, 2013 12:05 — forked from rdabbler/instructR.R
Learning R with Shiny
# Here a set of instructions corresponding to each code lesson is made into a dataset codelist
ID=as.numeric() # id of code lesson
instruct=as.character() # instructions for code lesson
subhead=as.character() # subheading for code lesson
i=1
ID[i]=i
subhead[i]="Simple R Expressions: Addition"
instruct[i]=paste('Try simple math','Type the command below','','1+1','',sep="\n")
@marcionicolau
marcionicolau / global.R
Created January 15, 2013 20:06 — forked from dempseydata/global.R
AB2 Test
###############################################
##
## Attempt no 2 at building a shiny web app
## for AB Testing use - using global.R
##
## global.R - loading and defining variables for the global environment
##
###############################################
# Pallette used in some charts as a general indicator color for better or worse that the control group
@marcionicolau
marcionicolau / server.R
Created January 15, 2013 18:57 — forked from jcheng5/server.R
Show Elapsed Time in shiny process
library(shiny)
shinyServer(function(input, output) {
output$intense <- reactivePrint(function() {
if(input$panel==2){
Sys.sleep(10)
return('Finished')
}else({return(NULL)})
})
library(shiny)
# load a very small projects file
# Eventually the idea is to have a database link to SQLite or access
projects=data.frame(pid=c(1,2,3,4,5),project=c("proj1","proj2","proj3","proj4","proj5"))
# Define server logic
shinyServer(function(input, output) {
# if Projects -> View Projects is selected, this outputs the lists in dataframe projects