Skip to content

Instantly share code, notes, and snippets.

Avatar

Kashif Rasul kashif

View GitHub Profile
@kashif
kashif / hs_2json.sql
Created Jan 31, 2012
Another hstore to JSON function by Andrew Dunstan
View hs_2json.sql
create or replace function hs_2json(hs hstore) returns text language sql
as $f$
select '{' || array_to_string(array_agg(
'"' || regexp_replace(key,E'[\\"]',E'\\\&','g') || '":' ||
case
when value is null then 'null'
when value ~ '^(true|false|(-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?))$' then value
else '"' || regexp_replace(value,E'[\\"]',E'\\\&','g') || '"'
end
@kashif
kashif / ubuntu-11.10-gems.erb
Created Oct 10, 2011 — forked from bensie/chef_bootstrap_rvm.erb
Chef bootstrap With rvm and ruby 1.9.3 on ubuntu 11.10
View ubuntu-11.10-gems.erb
bash -c '
<% if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %>
EOP
) > ~/.curlrc
<% end -%>
if [ ! -f /usr/bin/chef-client ]; then
@kashif
kashif / mk_postgis_template.sh
Created Nov 7, 2010
make a postgis template
View mk_postgis_template.sh
# Set postgis-1.5 path.
$ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5
# Creating the template spatial database
$ createdb -E UTF8 -T template0 template_postgis
# and add PLPGSQL language support.
$ createlang -d template_postgis plpgsql
# Loading the PostGIS SQL routines.
$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
View gdal.rb
require 'formula'
class Gdal <Formula
url 'http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz'
homepage 'http://www.gdal.org/'
md5 '05351f8cb61761ae579667e24a297fe6'
def options
[
['--with-pg', "Include PostgreSQL support."],