Skip to content

Instantly share code, notes, and snippets.

View thejeshgn's full-sized avatar

Thejesh GN thejeshgn

View GitHub Profile
@thejeshgn
thejeshgn / histogram.py
Created February 17, 2014 07:22
Hourly histogram of incoming calls
from datetime import datetime
from datetime import timedelta
diff_time_from_gmt = timedelta(minutes=330)
incoming = []
with open('/home/thej/Desktop/my_incoming_calls.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter='\t', quotechar='|')
for row in spamreader:
incoming.append( ( datetime.strptime(row[4], '%Y-%m-%d %H:%M:%S')+ diff_time_from_gmt ))
@thejeshgn
thejeshgn / dominant-color-finder.py
Last active August 29, 2015 13:58
Borrowed an modified code to find dominant colors.
#[ ] http://stackoverflow.com/questions/8915296/python-image-library-fails-with-message-decoder-jpeg-not-available-pil
#[ ] http://datasciencelab.wordpress.com/2013/12/12/clustering-with-k-means-in-python/
#[ ] https://gist.github.com/samuelclay/918751
#[ ] http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dominant-colors-in-images/
#[ ] http://0to255.com/5f8fbc
#[ ] http://stackoverflow.com/questions/3241929/python-find-dominant-most-common-color-in-an-image
from PIL import Image
from pylab import *
from scipy.misc import fromimage
import scipy
[
{
"id": "16954016022074178217-07321328812910646410-4",
"type": "GOOGLE_MAPS_ENGINE",
"source": {
"google_maps_engine": {
"sub_type": "VECTOR",
"vector_layer": {
"vector_layer_id": "o:ANVwnM25eNrId1vUCInJJfaac4PJYauAK2QkqSMDaslqaYldqQvn0Sem6dUjJf0a3JwtO_KMFh6KvYh4sodrgluf",
"layer_parameters": [
Bst_ID NAME Ward_No X Y
Blr_Bst000738 Trinity Circle (Church) 114 77.6198163125 12.9725111086
Blr_Bst000352 Philips (Ulsoor Lake) 114 77.6215996446 12.9728166674
Blr_Bst000354 Binnamangala 80 77.6403329619 12.9839499972
Blr_Bst000358 Benniganahalli 57 77.6635162857 12.9941499969
Blr_Bst000357 Kaggadasapura Jn (Big Bazaar) 57 77.6576162899 12.991299997
Blr_Bst000136 K. R. Puram Rlwy Station 56 77.6768829361 13.0002166667
Blr_Bst000792 ITI Bus Stop 55 77.6860829327 13.0055277744
Blr_Bst000771 Vannar Pete 114 77.6210496447 12.9563333274
Blr_Bst000740 Passport Office 147 77.6186496461 12.9461833275
select density.stop, density.strength, lat,lng from ( select bs.busstop stop , count(bs.busstop) as strength from bus_route bs , timings t where t.route_no = bs.route_no group by bs.busstop ) as density, busstop s where s.name=density.stop order by density.strength desc;
<!DOCTYPE html>
<html>
<head>
<title>Bangalore Maps</title>
<style>
#map {
width: 99%;
height: 500px;
}
@thejeshgn
thejeshgn / test.lua
Last active August 29, 2015 14:07
testing
return string.format("Hello, %s!", request.query.name or "World. Welcome to new world.")
https://twitter.com/geohacker/status/533201987563945984
https://twitter.com/ajantriks/status/533225676774449152
https://twitter.com/thej/status/533245978728738816
https://twitter.com/thej/status/533246645140348928
https://twitter.com/gkjohn/status/533257302988451840
https://twitter.com/iotakodali/status/533271309136842752
https://twitter.com/geohacker/status/533282550588772352
https://twitter.com/geohacker/status/533434840121876480
https://twitter.com/amitangshu/status/533455792951660544
https://twitter.com/nasrhadi/status/533458934812934144
@thejeshgn
thejeshgn / console.txt
Created November 24, 2014 06:02
Mapillary error
"Thanks for checking us out" mapapp-b49fef0d.js:15
"File bugs at https://github.com/mapillary/mapillary_issues" mapapp-b49fef0d.js:17
"Error: data.nodes is undefined
LocalNavigator</LocalNavigator.prototype.moveFetch/</<@http://dga406zepc8gy.cloudfront.net/javascripts/mapapp-b49fef0d.js:11969
t/</f[d]/q<@http://dga406zepc8gy.cloudfront.net/javascripts/lib-99552e38.js:307
De/e/l.promise.then/J@http://dga406zepc8gy.cloudfront.net/javascripts/lib-99552e38.js:140
De/f/<.then/<@http://dga406zepc8gy.cloudfront.net/javascripts/lib-99552e38.js:141
Yd/this.$get</h.prototype.$eval@http://dga406zepc8gy.cloudfront.net/javascripts/lib-99552e38.js:152
Yd/this.$get</h.prototype.$digest@http://dga406zepc8gy.cloudfront.net/javascripts/lib-99552e38.js:149
Yd/this.$get</h.prototype.$apply@http://dga406zepc8gy.cloudfront.net/javascripts/lib-99552e38.js:152
@thejeshgn
thejeshgn / opendata.json
Last active August 29, 2015 14:10
public_data_discovery_format.json
{
"name": "Open Bangalore Weather Data",
"description": "Open Bangalore Weather Data",
"image": "",
"humanURL": "github.com/openbangalore/weather",
"copyright":{
"holder":"Thejesh GN",
"type":"CC BY-SA 3.0",
"url":"https://creativecommons.org/licenses/by-sa/3.0/"
},