Skip to content

Instantly share code, notes, and snippets.

View azvoleff's full-sized avatar

Alex Zvoleff azvoleff

View GitHub Profile
@azvoleff
azvoleff / parallel_example.R
Last active August 29, 2015 14:00
Parallel processing example
library(foreach)
library(doParallel)
# In the call below, 2 is the number of cores to use - set this to be less than
# the total number of cores you have.
cl <- makeCluster(2)
results <- foreach(i=1:5, .packages=c('pkg1', 'pkg2')) %dopar% {
# Do some stuff in here, and save the results in "results"
library(raster)
library(stringr)
img_file <- 'PSH_mosaic_2010_predictors.tif'
img <- stack(img_file)
img <- setMinMax(img)
# Setup a list with metadata on the image.
img_meta <- list(site=str_extract(img_file, '^[a-zA-Z]*'),
# Script to test basic handling of raster images with distributedR. Loads
# imagery from a Vertica database.
#
# Alex Zvoleff, azvoleff@conservation.org, July 2014
library(distributedR)
library(vRODBC)
Sys.setenv(VERTICAINI="/home/alexz/vertica.ini")
Sys.setenv(ODBCINI="/home/alexz/odbc.ini")
#distributedR_start()
@azvoleff
azvoleff / varnish
Last active August 29, 2015 14:23 — forked from reifman/varnish
# Configuration file for varnish
#
# /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK
# to be set from this shell script fragment.
#
# Should we start varnishd at boot? Set to "no" to disable.
START=yes
# Maximum number of open files (for ulimit -n)
@azvoleff
azvoleff / varnish
Last active August 29, 2015 14:23
/etc/init.d/varnish
#! /bin/sh
### BEGIN INIT INFO
# Provides: varnish
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start HTTP accelerator
# Description: This script provides a server-side cache
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
# backend default {
# .host = "127.0.0.1";
# .port = "8080";
# }
#!/bin/bash
#
# An example init script for running a Node.js process as a service
# using Forever as the process monitor. For more configuration options
# associated with Forever, see: https://github.com/nodejitsu/forever
#
# You will need to set the environment variables noted below to conform to
# your use case, and change the init info comment block.
#
# This was written for Debian distributions such as Ubuntu, but should still
#!/bin/bash
#
# An example init script for running a Node.js process as a service
# using Forever as the process monitor. For more configuration options
# associated with Forever, see: https://github.com/nodejitsu/forever
#
# You will need to set the environment variables noted below to conform to
# your use case, and change the init info comment block.
#
# This was written for Debian distributions such as Ubuntu, but should still
#!/bin/bash
### BEGIN INIT INFO
# Provides: cartodb-rails-server
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the CartoDB rails web server
# Description: starts CartoDB rails server
#!/bin/sh
#
# chkconfig: - 85 15
ROOT="/home/ubuntu/cartodb"
USER="ubuntu"
ENVIRONMENT="development"
QUEUES="*"
COUNT=1