Conversion between Singapore Coordinate System SVY21 and World Geodetic System WGS84

In August 2004, Singapore Land Authority introduced the new coordinated cadastre system, SVY21.

Recently, I need to use data from both onemap and google map, and the difference in coordinate systems made it pain in the ass to work with. So I wrote a Python script to convert to and from both coordinate systems.

Basically I used the geometry service provided by Esri Arcgis Online at ” http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer

The script is hosted on https://github.com/zkkmin/coordconvert .

Since I wrote it mainly for my task requirement, you might need to modify it for your own usage 😀

Simple site monitoring and alerting using Python & Twilio SMS

My company has a website with mostly static contents running on an old Linux machine. We hardly need to update the contents over a long period of time and everyone forgot about it. Then we got complaints from users as the site went down for a while. We fixed the problem and got back the site up in no time but it was quite embarrassing.

So I decided to implement a simple monitoring and alert system for future breakdown since the box is like really really old. I wrote a Python script to make requests to web pages and give out alert via sms if failed. For sms alert I used Twilio API.


import urllib
from twilio.rest import TwilioRestClient

def send_sms(urlstr, msg_string):
	account_sid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
	auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
	client = TwilioRestClient(account_sid, auth_token)

	message = client.sms.messages.create(body="Server Status (%s) : %s" % (urlstr, msg_string) , to="RECEIVER NUMBER", from_="YOUR TWILIO NUMBER" )
	print message.sid

def main():
	urlstr = "http://ourwebsite.com/"
	result = ""
	try:
		result = str(urllib.urlopen(urlstr).getcode())

	except Exception,e:
		result = "SERVER DOWN"

	if result != "200":
		send_sms(urlstr, result)
		#print "NOT OK"

	print result

if __name__ == '__main__':
	main()

Above simple script will check and send out sms if the web site is down. Go check out Twilio for awesome phone and sms system.