This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def degrees_to_cardinal(d): | |
| ''' | |
| note: this is highly approximate... | |
| ''' | |
| dirs = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", | |
| "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"] | |
| ix = int((d + 11.25)/22.5) | |
| return dirs[ix % 16] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # LICENSE: public domain | |
| def calculate_initial_compass_bearing(pointA, pointB): | |
| """ | |
| Calculates the bearing between two points. | |
| The formulae used is the following: | |
| θ = atan2(sin(Δlong).cos(lat2), | |
| cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2012, Ryan Gomba | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright notice, this | |
| # list of conditions and the following disclaimer. | |
| # 2. Redistributions in binary form must reproduce the above copyright notice, | |
| # this list of conditions and the following disclaimer in the documentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * setup JQuery's AJAX methods to setup CSRF token in the request before sending it off. | |
| * http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request | |
| */ | |
| function getCookie(name) | |
| { | |
| var cookieValue = null; | |
| if (document.cookie && document.cookie != '') { | |
| var cookies = document.cookie.split(';'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| postgres=# \dx | |
| List of installed extensions | |
| Name | Version | Schema | Description | |
| ---------+---------+------------+------------------------------ | |
| plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language | |
| (1 row) | |
| postgres=# \dx+ | |
| Objects in extension "plpgsql" | |
| Object Description |
NewerOlder