Skip to content

Instantly share code, notes, and snippets.

@asdqwe3124
asdqwe3124 / vincenty.php
Created July 21, 2018 03:11 — forked from milesich/vincenty.php
Calculate geodesic distance (in meters) between two points specified by latitude/longitude using Vincenty inverse formula for ellipsoids.
<?php
/**
* Calculate geodesic distance (in meters) between two points specified by
* latitude/longitude using Vincenty inverse formula for ellipsoids
*
* from: Vincenty inverse formula - T Vincenty, "Direct and Inverse
* Solutions of Geodesics on the Ellipsoid with application of nested
* equations", Survey Review, vol XXII no 176, 1975
* http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
*
@asdqwe3124
asdqwe3124 / vincenty.php
Created July 21, 2018 03:12 — forked from lkacenja/vincenty.php
Vincenty Formula Jacked From Navigator PHP
// Inputs in Radians so degtorad degrees first.
function vincenty($lat1, $lon1, $lat2, $lon2) {
// Equitorial Radius
$a = 6378137.0;
// Polar Radius
$b = 6356752.31424518;
//Flattening of the ellipsoid
$f = 0.00335281066;
// Difference in longitude
$L = $lon2 - $lon1;
alert(document.domain);
@asdqwe3124
asdqwe3124 / gd
Last active March 12, 2020 23:30
gd
<?php
//php gd-gif.php image.gif gd-image.gif
$gif = imagecreatefromgif($argv[1]);
imagegif($gif, $argv[2]);
imagedestroy($gif);
?>
@asdqwe3124
asdqwe3124 / mock-smtp-server.js
Created December 7, 2020 10:28
mock-smtp-server.js
const SMTPServer = require("smtp-server").SMTPServer;
const TelegramBot = require('node-telegram-bot-api');
const fetch = require('node-fetch');
const TelegramToken = '';
const bot = new TelegramBot(TelegramToken, {polling: false});
const chatId = '';
const server = new SMTPServer({
onConnect(session, callback) {
// if (session.remoteAddress === "10.10.10.2") {