Skip to content

Instantly share code, notes, and snippets.

View jansc's full-sized avatar

Jan Schreiber jansc

View GitHub Profile
@thomasorten
thomasorten / UTMtoLatLon.php
Created July 18, 2013 20:12
Convert UTM northing/easting to latitude and longitude.
<?php
// Original source from Steven Dutch, https://www.uwgb.edu/dutchs/UsefulData/ConvertUTMNoOZ.HTM
// Rewritten by Thomas Orten
function UTMtoLatLon ($input_lat, $input_long, $utm_zone, $south_of_equator = false) {
$DatumEqRad = array(6378137.0, 6378137.0, 6378137.0, 6378135.0, 6378160.0, 6378245.0, 6378206.4, 6378388.0, 6378388.0, 6378249.1, 6378206.4, 6377563.4, 6377397.2, 6377276.3);
$DatumFlat = array(298.2572236, 298.2572236, 298.2572215, 298.2597208, 298.2497323, 298.2997381, 294.9786982, 296.9993621, 296.9993621, 293.4660167, 294.9786982, 299.3247788, 299.1527052, 300.8021499);
$Item = 0; // Default
$k0 = 0.9996; // scale on central meridian
@suprememoocow
suprememoocow / winston-logrotate.js
Last active May 11, 2019 01:19
A function for reopening a winston File logging transport post logrotation on a HUP signal. To send a HUP to your node service, use the postrotate configuration option from logrotate. `postrotate kill -HUP ‘cat /var/run/mynodeservice.pid‘`
function reopenTransportOnHupSignal(fileTransport) {
process.on('SIGHUP', function() {
var fullname = path.join(fileTransport.dirname, fileTransport._getFile(false));
function reopen() {
if (fileTransport._stream) {
fileTransport._stream.end();
fileTransport._stream.destroySoon();
}