Skip to content

Instantly share code, notes, and snippets.

View haoliangyu's full-sized avatar

Haoliang Yu haoliangyu

View GitHub Profile
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
@haoliangyu
haoliangyu / dataset-api.md
Created February 11, 2017 05:32
ArcGIS Open Data API unoffical documentation

Dataset Search API

Example

http://data.portal.com/datasets?q=test

Parameters

@haoliangyu
haoliangyu / arcgis.md
Last active March 4, 2024 01:40
Open Data API Comparison
@haoliangyu
haoliangyu / pick-problematic.js
Last active January 11, 2017 04:30
Problematic ArcGIS Open Data Portals
const fs = require('fs');
const rp = require('request-promise');
const Promise = require('bluebird');
const _ = require('lodash');
const cheerio = require('cheerio');
let portals = JSON.parse(fs.readFileSync('open-data-sources.json'));
let arcgisPortals = _.chain(portals)
.filter(portal => {
return portal.fields.url.indexOf('arcgis') > -1 && portal.fields.has_issue !== 'TRUE';
@haoliangyu
haoliangyu / docker.sh
Created January 3, 2017 14:27
Delete all docker containers and images
# From https://github.com/docker/docker/issues/928
docker rm `docker ps -a -q`
docker rmi `docker images -q`
@haoliangyu
haoliangyu / userAgentList.json
Last active August 18, 2022 20:54
User-Agent List
[
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1469.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1469.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:35.0) Gecko/20100101 Firefox/35.0",
"Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
@haoliangyu
haoliangyu / HaversineFormula
Last active June 20, 2019 08:33
Python function to calculate distance between two geographic locations
from math import radians, cos, sin, asin, sqrt
def haversine(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
"""
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
@haoliangyu
haoliangyu / Approximate station location
Created February 5, 2015 04:38
Python script to download daily weather data from Korea Meteorological Administration
id,korean,english,latitude,longitude
0,서울,Seoul,37.566535,126.9779692
1,백령도,Baengnyeong,37.9728415,124.718271
2,동두천,Dongducheon,37.9034112,127.0605075
3,문산,Munsan,37.889992,126.6987
4,인천,Incheon,37.4562557,126.7052062
5,수원,Suwon,37.2635727,127.0286009
6,강화,ganghwa,37.7131742,126.4511281
7,양평,Yangpyeong,37.4912195,127.4875607
8,이천,Icheon,37.2719952,127.4348221
@haoliangyu
haoliangyu / LayerComboBox
Created January 20, 2015 17:00
Layer ComboBox of ArcMap AddIn
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;
using ESRI.ArcGIS;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Desktop.AddIns;