Skip to content

Instantly share code, notes, and snippets.

@kenguish
kenguish / HamGridMaidenheadConversion.swift
Last active December 9, 2021 10:17
Conversion of Amateur Radio Maidenhead Grid code to latitude longitutde coordinate in Swift
import Foundation
class HamGridMaidenheadConversion {
private let upper = "ABCDEFGHIJKLMNOPQRSTUVWX"
private let lower = "abcdefghijklmnopqrstuvwx"
private func ord(_ value:UnicodeScalar) -> Int {
return Int(( value as UnicodeScalar).value)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kenguish
kenguish / gist:3801140156d1c4cd72c1
Last active March 9, 2016 07:07
data.gov.hk Address Lookup Service Python JSON Helper
import requests
'''
Valid language: en, zh-Hant
'''
def address_check( address, language="en" ):
if language not in ['en', 'zh-Hant']:
raise ValueError('language is not specified correctly. Either in \'en\' or \'zh-Hant\'')
headers = {
@kenguish
kenguish / gist:eab115b9b6127b2bedae
Last active March 9, 2016 07:01
data.gov.hk Address Lookup Service Python Helper
import requests
'''
Valid language: en, zh-Hant
'''
def address_check( address, language="en" ):
if language not in ['en', 'zh-Hant']:
raise ValueError('language is not specified correctly. Either in \'en\' or \'zh-Hant\'')
headers = {
# https://github.com/kenguish/python-hkpl
# Fleur Hong Kong flower shop http://fleur.hk/
import sys, os, re, string
from urllib2 import HTTPError
import re
import mechanize
from BeautifulSoup import BeautifulSoup