Skip to content

Instantly share code, notes, and snippets.

View kashif's full-sized avatar

Kashif Rasul kashif

  • Berlin, Germany
  • 07:45 (UTC +02:00)
  • X @krasul
View GitHub Profile
@kashif
kashif / ubuntu-11.10-gems.erb
Created October 10, 2011 11:58 — forked from bensie/chef_bootstrap_rvm.erb
Chef bootstrap With rvm and ruby 1.9.3 on ubuntu 11.10
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 / hs_2json.sql
Created June 17, 2011 10:26
hstore to json function from Ilya Kosmodemiansky
CREATE FUNCTION public.hs_2json(hs hstore) RETURNS text AS $$
DECLARE
rv text;
r record;
BEGIN
rv:='';
for r in (select key, val from each(hs) as h(key, val)) loop
if rv<>'' then
rv:=rv||',';
end if;
@kashif
kashif / geodatabases.md
Created May 27, 2011 10:09
GeoDatabases - a discussion

GeoDatabases

What is a GeoDatabase? and how is it diff from a regular db

  • Stores geometries
  • multi-dimensional
  • R-Tree indexing (Query planner uses it?)
  • projections
  • Supports Datums ?
  • Vector and raster support
@kashif
kashif / mk_postgis_template.sh
Created November 7, 2010 16:16
make a postgis template
# 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
@kashif
kashif / libjpeg-turbo.rb
Created November 3, 2010 00:09
Homebrew formula for libjpeg-turbo, a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression.
require 'formula'
class LibjpegTurbo <Formula
url 'http://downloads.sourceforge.net/sourceforge/libjpeg-turbo/libjpeg-turbo-1.0.1.tar.gz'
homepage 'http://libjpeg-turbo.virtualgl.org/'
md5 'e94b72694c9afd716458367dfe84ce1e'
if Hardware.is_64_bit?
depends_on 'nasm'
end
require 'formula'
class Geos <Formula
url 'http://download.osgeo.org/geos/geos-3.2.2.tar.bz2'
homepage 'http://trac.osgeo.org/geos/'
md5 'c5d264acac22fe7720f85dadc1fc17c6'
def options
[
['--enable-python', "Enable build of python module."],
@kashif
kashif / gdal.rb
Created July 21, 2010 13:10 — forked from sabman/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."],
@kashif
kashif / FindM
Created September 4, 2009 21:32
# Try to find MathLink from Wolfram Mathematica package
#
# See http://www.wolfram.com/solutions/mathlink/
#
# Once run this will define:
#
# MathLink_FOUND
# MathLink_INCLUDE_DIR
# MathLink_LIBRARIES
# MathLink_MPREP_BINARY
In[1]:= Install["scalarProd"]
Out[1]= LinkObject[./scalarProd,8,7]
In[2]:= ScalarProd[{2.1,3.2},{4.3,5.4}]
Out[2]= 26.31
In[3]:= UnInstall[%1]
Out[3]= UnInstall[LinkObject[./scalarProd,8,7]]
#include "scalarProd_kernel.cu"
void scalarProd(void)
{
float *h_A, *h_B, *h_C_GPU;
float *d_A, *d_B, *d_C;
char **heads_A, **heads_B;
int *dims_A, *dims_B;
int rank_A, rank_B;