Skip to content

Instantly share code, notes, and snippets.

@yayoF
yayoF / Distance2points
Last active August 4, 2016 14:51
Function: Distance between 2 points. Char unit is to know what metric to return. K returns kilometers. If the distance is less than 1km you have to return in meters. Returns strings (e.g.: 9 kms o 360 mts.)
private double distance(double startLat, double startLon, double endLat, double endLon, char unit){
double theta = startLon - endLon;
double dist = Math.sin(deg2rad(startLat)) * Math.sin(deg2rad(endLat)) + Math.cos(deg2rad(startLat)) * Math.cos(deg2rad(endLat)) * Math.cos(deg2rad(theta));
dist = Math.acos(dist);
dist = rad2deg(dist);
dist = dist * 60 * 1.1515;
if (unit == 'K') {
dist = dist * 1.609344;
} else if (unit == 'N') {
dist = dist * 0.8684;
@yayoF
yayoF / gist:224c43e34705a6e51afc725d760f7a53
Last active May 1, 2024 11:19
Install Telegram Desktop in Ubuntu
Download the telegram Desktop client here https://desktop.telegram.org/
Go to the client location in terminal and extract the package with < tar xf archive.tar.xz >
Now you have a folder called < Telegram >
Move this folder to /opt
Double-click the telegram binary in /opt/Telegram/Telegram.
Bonus: to add Telegram to de "applications" menu, right-click the icon of the runing app and choose "lock to launcher"
bon appetit
sources:
@yayoF
yayoF / gist:f7991d1bf477d17e433036c237078e89
Created June 22, 2018 15:55
Install OpenVpn on Ubuntu 16
https://openvpn.net/index.php/access-server/docs/admin-guides/182-how-to-connect-to-access-server-with-linux-clients.html