Skip to content

Instantly share code, notes, and snippets.

View happysundar's full-sized avatar

Sundar Rajagopalan happysundar

View GitHub Profile
@happysundar
happysundar / plpython_returning_record.py
Last active August 7, 2020 23:05
Example of a PLPythonU method that returns a record
DROP FUNCTION IF EXISTS get_role_to_actor_and_actor_to_role( INOUT BIGINT, OUT JSONB, OUT JSONB );
CREATE OR REPLACE FUNCTION get_role_to_actor_and_actor_to_role(
INOUT program_id BIGINT,
OUT actor_to_role JSONB,
OUT role_to_actor JSONB)
RETURNS RECORD IMMUTABLE
AS $plpython_function$
import json
@happysundar
happysundar / setup port forwarding to enable remote debugging in vagrant vm.md
Created January 30, 2014 07:36
Getting the remote debugger to work with a java process running in a vagrant vm

Vagrant vm network config

In the Vagrantfile, do :

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  config.vm.network :public_network
@happysundar
happysundar / docker_commands.md
Last active February 1, 2017 04:38
docker commands

Creating an image

  1. Create a single Dockerfile in ~/dockerfile/Dockerfile
FROM centos
VOLUME /Users/sundar.rajagopalan/Downloads
VOLUME /Users/sundar.rajagopalan/docker-dir
RUN ["useradd", "builder"]
RUN ["yum", "install", "rpm-build", "-y"]
@happysundar
happysundar / pyspatialite_install_instructions.md
Last active December 27, 2016 08:12
how to install pyspatialite

Install prerequisite package dependencies

From http://elgis.argeo.org/repos/6/, find the latest repo rpm, and install it as root:

`sudo rpm -Uvh http://elgis.argeo.org/repos/6/elgis-release-6-6_0.noarch.rpm`

Install Dependency Packages:


  1. yum install python-devel (needed by Shapely to compile C extensions)

fpm -s dir -t rpm -C /build -a all --verbose --no-depends --provides email-insights.jar -n email-insights -v 1.0.4 --prefix /opt/idp/email-insights email-insights.jar

@happysundar
happysundar / setup.py
Created May 11, 2016 19:40
Sample setup.py
# $ virtualenv venv
# $ . venv/bin/activate
# $ pip install --editable
from setuptools import setup
setup(
name='repl_domstore',
version='0.1',
py_modules=['repl_domstore'],
@happysundar
happysundar / pythonz and python_burrito.md
Created August 8, 2013 02:27
useful virtualenv/virtualenvwrapper commands

Use https://github.com/saghul/pythonz to install different versions of python

To install virtualenv, virtualenvwrapper et all natively (i.e, on the python "system" path of the machine), do a :

curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | $SHELL
mkvirtualenv -p ~/.pythonz/pythons/CPython-2.7.5/bin/python ~/VEnvs/MyProject
mkvirtualenv -p ~/.pythonz/pythons/CPython-2.7.5/bin/python -a ~/Rovi -r ./requirements.txt rovi
@happysundar
happysundar / .bash_profile
Created August 8, 2013 01:13
my bash profile.
PS1="[\[\033[32m\]\w]\[\033[0m\]\n\[\033[1;36m\]\u@\h\a\[\033[1;33m\]-> \[\033[0m\]"
export SVN_EDITOR=vim
alias vm="ssh sundar@sundar-linux.melodis.com"
alias phpunit="phpunit --colors"
alias port="sudo port"
alias flushdns="dscacheutil -flushcache"
#alias vim='~/svim'

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@happysundar
happysundar / LogstashAppender.java
Created April 12, 2015 05:35
Logstash appender for dropwizard : this generates a logstash compatible log file that can be synced using the logstash-forwarder
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.Layout;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.dropwizard.logging.FileAppenderFactory;
import net.logstash.logback.encoder.LogstashEncoder;