Let’s Encrypt is a free, automated, and open Certificate Authority.
- Install tools for using the Let's Encrypt certificates using Certbot
sudo apt-get update \
sudo apt-get install software-properties-common
import CoreLocation | |
extension CLLocationCoordinate2D { | |
func boundingBox(radius: CLLocationDistance) -> (max: CLLocationCoordinate2D, min: CLLocationCoordinate2D) { | |
// 0.0000089982311916 ~= 1m | |
let offset = 0.0000089982311916 * radius | |
let latMax = self.latitude + offset | |
let latMin = self.latitude - offset | |
// 1 degree of longitude = 111km only at equator |
// | |
// Reachability.swift | |
// Etcetera | |
// | |
// Copyright © 2018 Nice Boy LLC. All rights reserved. | |
// | |
import Foundation | |
import SystemConfiguration |
let names = ["Paul", "Elena", "Zoe"] | |
extension Sequence { | |
func last(where predicate: (Iterator.Element) -> Bool) -> Iterator.Element? { | |
for element in reversed() where predicate(element) { | |
return element | |
} | |
return nil | |
} |
func testInfoLoading() { | |
let url = "https://raw.githubusercontent.com/FahimF/Test/master/DogYears-Info.rtf" | |
HTTPClient.shared.get(url: url) { | |
(data, error) in | |
self.resData = data | |
} | |
let pred = NSPredicate(format: "resData != nil") | |
let exp = expectation(for: pred, evaluatedWith: self, handler: nil) |
let server = HTTPServer() | |
server.serverPort = 8080 | |
server.documentRoot = "webroot" | |
var routes = Routes() | |
routes.add(method: .get, uri: "/", handler: { | |
request, response in | |
response.setBody(string: "Hello, Perfect").completed() | |
}) |
require "Prime" | |
def largest_prime_factor(n) | |
return n if n.prime? | |
Prime.each do |p| | |
if n % p == 0 | |
k = n.to_f/p.to_f | |
if k.to_i.prime? | |
return k.to_i | |
else |
def fib(n) | |
if n <= 2 | |
return (1..n).to_a | |
else | |
k = n - 2 | |
arr = [1,2] | |
k.downto(2).each do |j| | |
i = arr[-2]+arr[-1] | |
arr = arr.push(i) if i < 4000000 | |
end |
using uint8_t = System.Byte; | |
class BinParser | |
{ | |
public struct GPS_LINE | |
{ | |
public DateTime datetime; | |
public string type; | |
public float lat; | |
public float lon; |
var R = 6371; // km | |
var dLat = (lat2-lat1).toRad(); | |
var dLon = (lon2-lon1).toRad(); | |
var lat1 = lat1.toRad(); | |
var lat2 = lat2.toRad(); | |
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + | |
Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); | |
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); | |
var d = R * c; |