Skip to content

Instantly share code, notes, and snippets.

View happysundar's full-sized avatar

Sundar Rajagopalan happysundar

View GitHub Profile
@happysundar
happysundar / java_and_spatialite.md
Created January 31, 2014 19:34
How to get Java and Spatialite working on a base Centos 6 box

Up and Running with Java and libspatialite : a from-the-scratch how-to

All instructions/links/version are valid as of Jan 29, 2014

Here is how I got up-and running with the Xerial JDBC driver and libspatialite on a Centos 6 x86_64 box.

Getting the “Native Libraries” (sqlite3/libspatialite)

Installing required YUM Repositories

# tmux config
# General {{{
set -g prefix `
unbind ^b
# Ring the bell if any background window rang a bell.
set -g bell-action any
@happysundar
happysundar / vagrant_commands.md
Created January 31, 2014 20:43
useful vagrant commands

Install vagrant-vbguest plugin

This installs the plugin that automatically upgrades the virtual machine’s vbox guest additions to match the virtual box version installed on the host machine:

vagrant plugin install vagrant-vbguest 

Here is how you get a basic Centos 6 box:

vagrant box add centos http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box
@happysundar
happysundar / maven commands.md
Created February 1, 2014 03:52
useful maven commands

Remote debug a test started with maven

This is useful when there are a lot of libraries that are included properly during a maven package..(i.e, in any real project!)

mvn -Dmaven.surefire.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=4044 -Xnoagent -Djava.compiler=NONE" -Dtest=GeoLocatorTest test

Display the classpath containing all dependencies and transitive dependencies

mvn dependency:build-classpath package

@happysundar
happysundar / mvn_failsafe_plugin.md
Created February 3, 2014 22:28
maven integration tests

Dividing tests into unit-test and integration-test in mave

We use the "failsafe" plugin in maven to run and manage integration tests.

Usually, when you build your project, you want to skip running the integration/regression tests;

So, you 'exclude' them from the usual 'test' phase by adding this (in the xpath /pom:project/pom:build/pom:plugins/pom:plugin) in your pom.xml:

 
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@happysundar
happysundar / apache_rewrite.ini
Created February 11, 2014 09:52
Rewrite rule to transform part of the path to a query string key/value pair
RewriteEngine On
#
# This rewrite rule will change a URI from something like :
# http://foo.com/corpus/59/d0/400_59d022a8dcc082473fac85dbb219e724SongStream-ParadeofLights-ServerSide-640x765.png
# Notice this part of the URI ^^^ -- that becomes a query parameter...
# i.e, into http://foo.com/corpus/59/d0/59d022a8dcc082473fac85dbb219e724SongStream-ParadeofLights-ServerSide-640x765.png?width=400
#
#
@happysundar
happysundar / using schema to validate command line arguments.py
Created February 21, 2014 20:37
This snippet shows how to use https://github.com/halst/schema to validate command line arguments in a python script. You should use https://github.com/docopt/docopt to handle command line arguments
schema = Schema(
{
'--schema_dir':
And(
And(
os.path.exists,
os.path.isdir,
lambda s: os.access(s, os.R_OK),
error="The path '%s' should be an existing directory and be readable. Please check" % arguments['--schema_dir']
),
@happysundar
happysundar / postgres.md
Created February 24, 2014 03:37
get postgres up and running in OS X Mavericks
  1. brew cask install postgres_app

  2. In the current version of Postgres.app, the supplemental binaries are installed in /Applications/Postgres.app/Contents/Versions/9.3/bin, not in /Applications/Postgres.app/Contents/MacOS/bin. So, edit your .[bash|zsh]rc and add :

    export PSQL_PATH=/Applications/Postgres.app/Contents/Versions/9.3/bin

Followed by: