Skip to content

Instantly share code, notes, and snippets.

@etes
etes / directorySize.ps1
Last active January 3, 2016 05:49
miscellaneous scripts
$startfolder = "c:\data\*"
$folders = get-childitem $startfolder | where{$_.PSiscontainer -eq "True"}
"Directory Name`tDirectory Size (MB)"
foreach ($fol in $Folders){
$colItems = (Get-ChildItem $fol.fullname -recurse | Measure-Object -property length -sum)
$size = "{0:N2}" -f ($colItems.sum / 1MB)
"$($fol.name)`t$size"
}
rows, cols = 10, 10
iceraster = (10*numpy.random.random((rows, cols))).astype(int)*5
iceraster = numpy.where( (iceraster >= 20), 20, iceraster)
outarray = numpy.zeros((rows, cols), numpy.float)
NumberOfDays = 3
#Obsolete pixel-by-pixel version, takes very long
for (i,j), value in numpy.ndenumerate(outarray):
if iceraster[i,j] == 0:
outarray[i,j] = outarray[i,j] + ( 0.0 / NumberOfDays)
elif iceraster[i,j] == 5:
@etes
etes / gist:6257400
Created August 17, 2013 15:21
requirement for deploying a web app.
maps.google.com
### get the google maps api key
### install django on ubuntu test server and centOS
### install PostGres and PostGIS 2.0
### install gdal on python 2.7
### get apache or ngnix server
### get openlayers and GeoDjango
@etes
etes / Install_Postgis_Ubuntu_11.10.sh
Created May 25, 2012 21:36 — forked from ikennaokpala/Install_Postgis_Ubuntu_11.10.sh
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
@etes
etes / boreholes.R
Last active October 2, 2015 16:18
plot borehole locations on Google Maps
library(rgdal)
library(RgoogleMaps)
boreholes<- read.csv("boreholes.csv", sep=",", header=TRUE)
bh_grd <- SpatialPoints(boreholes[,c("East","North")],
proj4string=CRS("+proj=utm +zone=32 +datum=WGS84"))
bholes<- SpatialPointsDataFrame(bh_grd,boreholes[,-c(2,3)])
bholes<-bholes[,-c(2,3)]
bh_geo<- spTransform(bholes, CRS("+proj=longlat +datum=WGS84"))
North<-coordinates(bh_geo)[,2]