Skip to content

Instantly share code, notes, and snippets.

View 1ec5's full-sized avatar
🙈
Not actively reading bugmail

Minh Nguyễn 1ec5

🙈
Not actively reading bugmail
View GitHub Profile
@1ec5
1ec5 / Locales.swift
Created September 15, 2021 23:43
Available locales on iOS 14.4
import Foundation
print(Locale.availableIdentifiers
.map { Locale.init(identifier: $0.replacingOccurrences(of: "_", with: "-")) }
.map { "\($0.identifier)\t\(Locale(identifier: "en-US").localizedString(forIdentifier: $0.identifier) ?? "")" }
.sorted()
.joined(separator: "\n"))
@1ec5
1ec5 / lanes.py
Last active September 16, 2021 17:58
Draw lane icon based on inputs
#!/usr/bin/env python
primaryColor = 0
secondaryColor = 0
availableLaneNames = [
"lane opposite slight turn or slight turn using slight turn",
"lane opposite slight turn or slight turn",
"lane opposite slight turn or straight or slight turn using slight turn",
"lane opposite slight turn or straight or slight turn using straight",
"lane opposite slight turn or straight or slight turn",
@1ec5
1ec5 / extract.sh
Created May 25, 2021 05:02
SDP PDFs by category
#!/bin/bash
ls -1 pdfs_by_category | sed 's/^\(.*\)\.txt/mkdir -p "extracts\/\1"/' | bash
function download_category {
cd "extracts/$1"
cat "../../pdfs_by_category/$1.txt" | xargs -L 1 wget
cd -
}
Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.name = "MapboxCoreNavigation"
s.version = '2.0.0-alpha.3.1'
s.summary = "Core components for turn-by-turn navigation on iOS."
s.description = <<-DESC
Mapbox Core Navigation provides the core spatial and timing logic for turn-by-turn navigation along a route. For a complete turn-by-turn navigation interface, use the Mapbox Navigation SDK for iOS (MapboxNavigation).
@1ec5
1ec5 / othertypes.tsv
Last active November 18, 2020 11:08
Business type descriptions for other businesses in Santa Clara County Social Distancing Protocol database
url typeofbusinessother
https://saesdp.sccgov.org/sdpdocs/3174340-SocialDistancingProtocolForm.pdf Streaming and outdoor production services
https://saesdp.sccgov.org/sdpdocs/3175907-SocialDistancingProtocolForm.pdf Farmer Market Vendor
https://saesdp.sccgov.org/sdpdocs/3172996-SocialDistancingProtocolForm.pdf Plumbing Company
https://saesdp.sccgov.org/sdpdocs/3174872-SocialDistancingProtocolForm.pdf Bakery
https://saesdp.sccgov.org/sdpdocs/3165898-SocialDistancingProtocolForm.pdf Quarry
https://saesdp.sccgov.org/sdpdocs/3174815-SocialDistancingProtocolForm.pdf ancillary hospital care
https://saesdp.sccgov.org/sdpdocs/3175499-SocialDistancingProtocolForm.pdf architecture
https://saesdp.sccgov.org/sdpdocs/3175068-SocialDistancingProtocolForm.pdf office
https://saesdp.sccgov.org/sdpdocs/3175860-SocialDistancingProtocolForm.pdf Home Bakery
@1ec5
1ec5 / simulation.md
Last active July 28, 2020 00:52
Comparison of route simulation features
Characteristic iOS Simulator Xcode Mapbox Navigation SDK
Works in the iOS simulator
Works on a device
Works without a debugger attached
Compatible with Wormhole
Can ship as part of an application
Simulates user-defined routes
Simulates going off route
Simulates course changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@1ec5
1ec5 / acgov.sh
Created May 23, 2020 07:04
Update the Wikimedia Commons table of COVID-19 cases in Berkeley and Alameda County, California
#!/bin/bash
# Fetch the current table as JSON
curl 'https://commons.wikimedia.org/wiki/Data:COVID-19_cases_in_Alameda_County,_California.tab?action=raw' > commons.json
# Fetch cases and deaths by day from the API
curl 'https://services3.arcgis.com/1iDJcsklY3l3KIjE/arcgis/rest/services/AC_dates/FeatureServer/0/query?where=1%3D1&outFields=Date,BkLHJ_Cases,BkLHJ_CumulCases,BkLHJ_Deaths,BkLHJ_CumulDeaths,ACLHJ_Cases,ACLHJ_CumulCases,ACLHJ_Deaths,ACLHJ_CumulDeaths,AC_Cases,AC_CumulCases,AC_Deaths,AC_CumulDeaths&outSR=4326&f=json' > dates.json
# Fetch hospitalizations by day from the API
curl 'https://services3.arcgis.com/1iDJcsklY3l3KIjE/arcgis/rest/services/AC_hospitalized2/FeatureServer/0/query?where=1%3D1&outFields=Date,Hospitalized_COVID_19_Positive_&outSR=4326&f=json' > hosp.json
@1ec5
1ec5 / datasf_covid19.sh
Last active May 18, 2020 16:17
Update the Wikimedia Commons table of COVID-19 cases in the City and County of San Francisco
#!/bin/bash
# Fetch the current table as JSON
curl 'https://commons.wikimedia.org/wiki/Data:COVID-19_cases_in_San_Francisco.tab?action=raw' > commons.json
# Fetch the new cases and deaths by day from the API
curl https://data.sfgov.org/resource/tvq9-ec9w.json > tvq9-ec9w.json
# Convert date from full timestamp to YYYY-MM-DD
# Pivot on dates as rows and counts by case disposition as columns
@1ec5
1ec5 / sccphd_covid19.sh
Last active May 10, 2020 20:49
Update the Wikimedia Commons table of COVID-19 cases in Santa Clara County, California
#!/bin/bash
# Fetch the current table as JSON
curl 'https://commons.wikimedia.org/wiki/Data:COVID-19_Cases_in_Santa_Clara_County,_California.tab?action=raw' > commons.json
# Fetch the new cases by day from the dashboard
# Convert date from number of milliseconds to YYYY-MM-DD
# Fill in counts repeated from previous days, which are indicated by C = null, R = 2
# Calculate a running total
curl 'https://wabi-us-gov-virginia-api.analysis.usgovcloudapi.net/public/reports/querydata' --compressed --data '{"version":"1.0.0","queries":[{"Query":{"Commands":[{"SemanticQueryDataShapeCommand":{"Query":{"Version":2,"From":[{"Name":"c","Entity":"cases_date"}],"Select":[{"Column":{"Expression":{"SourceRef":{"Source":"c"}},"Property":"Date"},"Name":"cases_date.Date"},{"Aggregation":{"Expression":{"Column":{"Expression":{"SourceRef":{"Source":"c"}},"Property":"New_cases"}},"Function":0},"Name":"Sum(cases_date.New_cases)"}]},"Binding":{"Primary":{"Groupings":[{"Projections":[0,1]}]},"DataReduction":{"DataVolume":4,"Primary":