Skip to content

Instantly share code, notes, and snippets.

View blaulan's full-sized avatar
🤪

Yue blaulan

🤪
View GitHub Profile
@blaulan
blaulan / loadGpx.js
Created May 28, 2024 08:59
load coordinate data from a GPX file
// load coordinate data from a GPX file
// the input will be a file uploaded by user
// the output will be a list of coordinates
function loadGPXFile(file) {
var reader = new FileReader();
reader.onload = function(e) {
var xml = e.target.result;
var gpx = new window.DOMParser().parseFromString(xml, "text/xml");
var coordinates = [];
var tracks = gpx.getElementsByTagName("trk");
@blaulan
blaulan / plot_pie_chart.py
Created April 23, 2024 06:14
plot pie chart in folium
import folium.plugins
def plot_pie_chart(layer, coord, radius, numbers, labels):
total = sum(numbers)
start_angle = 0
for index, number in enumerate(numbers):
if number == 0:
continue
percent = number / total
angle = round(percent * 360, 1)
@blaulan
blaulan / start.ahk
Last active May 7, 2018 20:44
AutoHotKey snippets
#SingleInstance Ignore
OnExit ExitSub
SetWorkingDir %A_ScriptDir%
; ----- Send Clipboard -----
!v::
SendInput {Raw}%clipboard%
Return
; ----- Always On Top -----
@blaulan
blaulan / trakt.py
Created April 18, 2017 03:28
remove trakt.tv duplicate history
# -*- coding: utf-8 -*-
# @Author: Yue Wu <me@blaulan.com>
# @Date: 2017-04-01 19:32:32
# @Last Modified by: Yue Wu
# @Last Modified time: 2017-04-17 23:24:13
import json
import requests