Skip to content

Instantly share code, notes, and snippets.

http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip
-- Deprecation in 1.2.3
CREATE OR REPLACE FUNCTION setSRID(chip,int4)
RETURNS chip
AS 'MODULE_PATHNAME','CHIP_setSRID'
LANGUAGE 'c' IMMUTABLE STRICT;
-- Deprecation in 1.2.3
CREATE OR REPLACE FUNCTION AsBinary(geometry)
RETURNS bytea
AS 'MODULE_PATHNAME','LWGEOM_asBinary'
LANGUAGE 'c' IMMUTABLE STRICT;
import math
from subprocess import call
import Image
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n)
return (xtile, ytile)
@Khalefa
Khalefa / gist:10066147
Last active August 29, 2015 13:58
Setup
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install git cmake g++ g++-4.8 gcc gcc-4.8 mpich2 bison flex libreadline-dev gfortran build-essential perl vim maven zlib1g-dev
git clone https://github.com/graphlab-code/graphlab.git
@Khalefa
Khalefa / dblp.dtd
Last active August 29, 2015 14:05
DBLP parser
<!ELEMENT dblp (article|inproceedings|proceedings|book|incollection|
phdthesis|mastersthesis|www)*>
<!ENTITY % field "author|editor|title|booktitle|pages|year|address|journal|volume|number|month|url|ee|cdrom|cite|publisher|note|crossref|isbn|series|school|chapter">
<!ELEMENT article (%field;)*>
<!ATTLIST article
key CDATA #REQUIRED
mdate CDATA #IMPLIED
publtype CDATA #IMPLIED
reviewid CDATA #IMPLIED
mono EditDistance.exe -p author.data 1
mono EditDistance.exe -p log.data 1
mono EditDistance.exe -p author+title.data 1
mono EditDistance.exe -p author.data 2
mono EditDistance.exe -p author+title.data 2
mono EditDistance.exe -p log.data 2
mono EditDistance.exe -p author.data 3
mono EditDistance.exe -p author+title.data 3
mono EditDistance.exe -p log.data 3
mono EditDistance.exe -p author.data 4
@Khalefa
Khalefa / EAS_MIS
Created September 2, 2014 14:16
Migrate EAS to MIS
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Excel = Microsoft.Office.Interop.Excel;
using System.IO;
namespace importer
{
https://archive.apache.org/dist/hadoop/core/hadoop-2.2.0/hadoop-2.2.0.tar.gz
@Khalefa
Khalefa / sort_string.cpp
Last active August 29, 2015 14:19
String Sorter
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <chrono>
#include<iostream>
using namespace std;