Skip to content

Instantly share code, notes, and snippets.

View rukku's full-sized avatar

RK Aranas rukku

  • Philippine Space Agency
  • Quezon City, Philippines
View GitHub Profile
@rukku
rukku / Z.bonus.r
Created February 28, 2012 09:36
Solution for solving Z
sink("Z.bonus.txt")
library(spatstat)
library(cwhmisc)
set.seed(40888)
ssize <- 5
ssize2 <- 10
#Create point patterns for testing
#create point pattern
@rukku
rukku / mdb_python.py
Created March 14, 2012 08:53
ODBC and Python
import csv
import pyodbc
MDB = 'c:/path/to/my.mdb'
DRV = '{Microsoft Access Driver (*.mdb)}'
PWD = 'mypassword'
conn = pyodbc.connect('DRIVER=%s;DBQ=%s;PWD=%s' % (DRV,MDB,PWD))
curs = conn.cursor()
@rukku
rukku / cbms_table.py
Created March 15, 2012 06:44
Extracts the "Household CBMS Core Indicators_DATA" table from the CBMS database
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Samsung-User
#
# Created: 15/03/2012
# Copyright: (c) Samsung-User 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
@rukku
rukku / upcatmystery.py
Created August 5, 2012 06:01
Math question from kenan
# x < 8
# x - y > 2
# what is max x + y
values = []
for x in range(100):
for y in range(100):
if x < 8 and x - y > 2:
print x + y
values.append(x+y)
@rukku
rukku / geoserver-ubuntu-ec2-install.sh
Created August 6, 2012 10:17
A Geoserver installation script for Ubuntu10.10
#
# install Geoserver on Ubuntu Lucid 10.10
# note: Geoserver is proxied through apache so port 8080 is not used
#
# @spara 11/15/10
#
# setup sources
sudo sh -c "echo ' ' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb http://us.archive.ubuntu.com/ubuntu/ Lucid multiverse' >> /etc/apt/sources.list"
@rukku
rukku / httpd.conf
Created August 21, 2012 04:39
XAMPP httpd.conf
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
@rukku
rukku / opengeo-suite-install.sh
Created September 4, 2012 09:38 — forked from spara/opengeo-suite-install.sh
OpenGeo Suite installer for Ubuntu with Apache proxy configured
#!/bin/bash
# setup repository
sudo wget -qO- http://apt.opengeo.org/gpg.key | apt-key add -
sudo chmod 655 /etc/apt/sources.list
sudo echo "deb http://apt.opengeo.org/ubuntu lucid main" >> /etc/apt/sources.list
sudo chmod 644 /etc/apt/sources.list
sudo apt-get update
# install opengeo suite
@rukku
rukku / Fix.py
Created September 14, 2012 14:49
GIS SE
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = 'C:\\Users\\a391665\\Documents\\ArcGIS\\Default.gdb'
ws = 'C:\\Users\\a391665\\Documents\\ArcGIS\\Default.gdb'
Comuni = 'C:\\Users\\a391665\\Documents\\ArcGIS\\Sardegna3.gdb\\Comuni'
Linee = 'C:\\Users\\a391665\\Documents\\ArcGIS\\Sardegna3.gdb\\Linee'
rows = arcpy.SearchCursor(Comuni)
@rukku
rukku / nn.line.point.py
Created September 19, 2012 17:16
Nearest neighbor between a point layer and a line layer
#!/usr/bin/env python
#Author: scw
from shapely.geometry import Point, Polygon
from math import sqrt
from sys import maxint
# define our polygon of interest, and the point we'd like to test
# for the nearest location
polygon = Polygon(((0, 0), (0, 1), (1, 1), (1, 0), (0, 0)))
point = Point(0.5, 1.5)
@rukku
rukku / fabfile.py
Created September 28, 2012 07:04 — forked from rburhum/fabfile.py
Fabric script to compile FileGDB
from fabric.api import *
from fabric.contrib.console import confirm
import tempfile
import re
PROJ_VER='4.8.0'
GEOS_VER='3.3.3'
GDAL_VER='1.9.0'
PROJ_PATH='/usr/local/proj/' + PROJ_VER