Skip to content

Instantly share code, notes, and snippets.

Avatar

Sharoon Thomas sharoonthomas

View GitHub Profile
View gist:9366756
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": {}, "id":"Andhra Pradesh", "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 80.149167, 13.618300 ], [ 80.142031, 13.544708 ], [ 80.126421, 13.584849 ], [ 80.158087, 13.591093 ], [ 80.120622, 13.605812 ], [ 80.149167, 13.618300 ] ] ], [ [ [ 82.258801, 16.689980 ], [ 82.285562, 16.697563 ], [ 82.368074, 16.723877 ], [ 82.311876, 16.602562 ], [ 82.258801, 16.689980 ] ] ], [ [ [ 82.299388, 16.714511 ], [ 82.293590, 16.743056 ], [ 82.211078, 16.727891 ], [ 82.221782, 16.750192 ], [ 82.174505, 16.725215 ], [ 82.257463, 16.689980 ], [ 82.292252, 16.608806 ], [ 82.259693, 16.586952 ], [ 82.299388, 16.591858 ], [ 82.267721, 16.564205 ], [ 82.309646, 16.567773 ], [ 81.720465, 16.309979 ], [ 81.364994, 16.359932 ], [ 81.345816, 16.330495 ], [ 81.392647, 16.342092 ], [ 81.231191, 16.235049 ], [ 81.145557, 15.973686 ], [ 81.004171, 15.840329 ], [ 81.006401, 15.757817 ], [ 80.943067, 15.719460 ], [ 80.822198, 15.712769 ], [ 80.78071
@sharoonthomas
sharoonthomas / gist:10221454
Created Apr 9, 2014
nginx configuration for SSL with better security
View gist:10221454
{
ssl on;
server_tokens off;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-RC4-SHA:ECDHE-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA;
# HTTP Strict Transport Security
add_header Strict-Transport-Security max-age=31536000;
View gist:10639248
class Router(object):
def __init__(self):
self.methods = {}
def route(self, url):
def decorator(wrapped):
wrapped.__route_info__ = (self, url)
return wrapped
return decorator
def register(self, url, method):
self.methods[url] = method
@sharoonthomas
sharoonthomas / gist:f24a0faa3b31f0204308
Last active Aug 29, 2015
Example of why JSON262 cannot be used in the real world as critical information is lost in the serialization JSON object
View gist:f24a0faa3b31f0204308

Using the same example given in the json262 documentation

>>> import datetime
>>> import json
>>> from json262 import JSON262Encoder
>>> data = {'day': datetime.date(2010, 2, 17)}
>>> data == json.loads(json.dumps(data, cls=JSON262Encoder))
False
@sharoonthomas
sharoonthomas / gist:72ff0af2809932d35426
Last active Aug 29, 2015
Using pip with Tryton modules
View gist:72ff0af2809932d35426
  1. Ensure that PIP is the latest version:

    pip install -U pip

  2. Installing a tryton module:

    pip install trytond_sale

    remember that it installs the most recent released version, as of this writing that is the 3.2 series.

@sharoonthomas
sharoonthomas / Dockerfile
Last active Aug 29, 2015
Example Dockerfile to setup tryton 3.2 with sale module and postgres
View Dockerfile
# Trytond 3.2 with Sale module and Postgres
#
# VERSION 3.2.0.1
FROM openlabs/tryton:3.2
MAINTAINER Sharoon Thomas <sharoon.thomas@openlabs.co.in>
# Setup psycopg2 since you want to connect to postgres
# database
RUN apt-get -y -q install python-dev libpq-dev
@sharoonthomas
sharoonthomas / dashboard.json
Last active Aug 29, 2015
Test JSON data for a dashboard
View dashboard.json
{
"sales_mtd": 120000
}
View keybase.md

Keybase proof

I hereby claim:

  • I am sharoonthomas on github.
  • I am sharoonthomas (https://keybase.io/sharoonthomas) on keybase.
  • I have a public key whose fingerprint is E275 1DEF 5862 5069 F66D 6ED4 F87C 6A2D F9BB 6DF8

To claim this, I am signing this object:

@sharoonthomas
sharoonthomas / angular-tryton-party-service.js
Created Nov 21, 2014
Example of using angular tryton to fetch parties and addresses
View angular-tryton-party-service.js
'use strict';
angular.module('trytonCrmApp')
.factory('party', [
'session',
function (session) {
var getAll = function (domain, offset, limit) {
return session.rpc('model.party.party.search_read', [
domain || [], offset || null, limit || 20
]);
View gist:e8930945a01098f2af84
sh-3.2$ cd /tmp
sh-3.2$ virtualenv test-nereid-cms-install
New python executable in test-nereid-cms-install/bin/python2.7
Also creating executable in test-nereid-cms-install/bin/python
Installing setuptools, pip...done.
sh-3.2$ cd test-nereid-cms-install/
sh-3.2$ source bin/activate
sh-3.2$ which pip
/private/tmp/test-nereid-cms-install/bin/pip
sh-3.2$ pip install trytond-nereid-cms
You can’t perform that action at this time.