Skip to content

Instantly share code, notes, and snippets.

View stormxuwz's full-sized avatar
🤣
Sleepy?

Wenzhao Xu stormxuwz

🤣
Sleepy?
View GitHub Profile
-- LaunchBar Action Script
-- apple script to append launchbar input to the last line of omnioutliner
on handle_string(_string)
tell application "OmniOutliner 4.6.1"
set theDocument to the front document
set newRow to make new row at last row of front document
set topic of newRow to _string
outdent newRow
@stormxuwz
stormxuwz / plot_gly_on_map.R
Created April 28, 2017 23:49
customized glyph-maps
plot_gly_on_map <- function(newDF, global = FALSE, trend = FALSE, outputFile = "test.png"){
# newDF$value <- newDF$summerSum_UHY - newDF$springSum_UHY
longRange <- range(newDF$Long)
latRange <- range(newDF$Lat)
bbox <- make_bbox(longRange,latRange,f = 0.3)
# myMap <- get_map(location=bbox, source="stamn",crop=TRUE,color="bw",maptype="terrain")
myMap <- get_map(location = bbox, maptype="toner-lite", source="stamen",zoom=7,color = "bw",crop=TRUE)
# ggmap(myMap)
SU_locations <- unique(newDF[,c("Station","Lat","Long")])
@stormxuwz
stormxuwz / coverIntervals.py
Last active May 22, 2017 22:20
coverIntervals.py
# list_forecasts = [[1,3],[2,5]]
## cover(1pm, 7pm, [[1,3], [5,7]])
## return [[3,5]]
def cover(startTime, endTime, list_forecasts):
n = len(list_forecasts)
@stormxuwz
stormxuwz / rf_python.py
Created July 18, 2017 00:00
random forest in python
# gist only to keep record from https://www.jiqizhixin.com/articles/bb59b879-e030-400d-abbc-d9c0708266ff
# Random Forest Algorithm on Sonar Dataset
from random import seed
from random import randrange
from csv import reader
from math import sqrt
# Load a CSV file
def load_csv(filename):