Skip to content

Instantly share code, notes, and snippets.

@jgcasta
jgcasta / XmlGregorianCalendar2String.java
Last active August 29, 2015 13:55
Return a String date with format dd-MM-yyyy from a XMLGregorianCalendar
/**
* Return a String date with format dd-MM-yyyy from a XMLGregorianCalendar
*
* @param cal
* @return
*/
public String XmlGregorianCalendar2String(XMLGregorianCalendar cal){
String str = "";
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
@jgcasta
jgcasta / IberiaSRTM2Tiles.sh
Last active August 29, 2015 13:59
Shell script to Download SRTM2 tiles for Iberia
#!/bin/bash
# Download SRTM2 Tiles for Iberia (http://www2.jpl.nasa.gov/srtm/)
#
# Jose Gomez Castano jgomez03@pdi.ucm.es
wget http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N35E000.hgt.zip
wget http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N35E001.hgt.zip
wget http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N35E002.hgt.zip
wget http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N35E003.hgt.zip
@jgcasta
jgcasta / ChangeVBMem.sh
Created June 14, 2014 10:59
Change memory size for a running Virtual Box virtual machine
#!/bin/bash
#
# ChangeVBMem.sh
#
# ver 1.0
#
# Jose Gomez Castaño jgcasta@gmail.com
#
# Change memory size for a running virtual machine. The system will be stopped and restarted
@jgcasta
jgcasta / mergeSHP.sh
Created August 27, 2014 15:51
Shell script to merge a list of SHP files from a set of directories
#!/bin/bash
ogr2ogr -a_srs EPSG:4326 out.shp
directories=$(find . -type d)
for directory in $directories
do
files=$(find $directory -name '*.shp')
@jgcasta
jgcasta / listenerStomppyModified.py
Last active August 29, 2015 14:08
Read message variable from class listener when using Stomp interface to ActiveMQ
#!/usr/bin/env python
# ------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@jgcasta
jgcasta / GetExtent
Last active December 12, 2015 08:58
Get the extent from a shapefile
#!/usr/bin/env python
# -*- coding: utf-8
"""
Get extent from SHP
version 1.0
autor José Gómez Castaño
email jgcasta@gmail.com
@jgcasta
jgcasta / plotHistogram
Last active December 12, 2015 09:09
Plot histogram data
#! /usr/bin/env python
# -*- coding: utf-8
"""
Plot histogram
version 1.0
autor José Gómez Castaño
email jgcasta@gmail.com
@jgcasta
jgcasta / AnalemaMadrid
Created February 21, 2013 23:05
Plot an Analema visible from Madrid
#!/usr/bin/python
"""
Traza la Analema para un Madrid
@precondition: se necesita tener el paquete Ephem
"""
import ephem
@jgcasta
jgcasta / DeleteOracle
Created February 22, 2013 11:50
Delete oracle old entries shell script
#!/bin/bash
# Delete 1 year before today
#
# 20/02/2013 v1.0
#
#
ANO=$(date +%Y)
@jgcasta
jgcasta / AddCentos5Repositories
Created March 16, 2013 11:51
Add and update EPEL and RPMFusion repositories in a CentOS 5
#!/bin/bash
# Add and update EPEL and RPMFusion repositories in a CentOS 5
# jgcasta at gmail dot com
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -import RPM-GPG-KEY.dag.txt
rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -ivh http://mirror.chpc.utah.edu/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm