Skip to content

Instantly share code, notes, and snippets.

View markocherrie's full-sized avatar
🎯
Focusing

Mark markocherrie

🎯
Focusing
View GitHub Profile
import requests
import os
# Replace 'your_personal_access_token' with your actual token
token = "your_personal_access_token"
headers = {
'Authorization': f'token {token}'
}
# GitHub API URL for gists
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
############### DATA COLLECTION #########################
## scaping the edinburgh university website
library(rvest)
# Gather the optional courses for Earth Observation and Geoinformation Management
MScOptionsURLS<-function(MSc){
if(MSc=="EOGM"){
MSc<-"https://www.ed.ac.uk/geosciences/postgraduate/taught-masters/msc-earth-observation/structure-teaching-assessment/optional-courses"
url<-MSc %>%
read_html()%>%
////////////////// IMPORT ///////////////////////////////////
// Load from Google repository
var hansenImage = ee.Image('UMD/hansen/global_forest_change_2015');
// Load from Fusion table
var BOUND = ee.FeatureCollection('ft:1cNBoXaEh9Ye5J31ESUQOBOrnkVBflJDodKlqdQs_', 'geometry');
@markocherrie
markocherrie / postgres_queries_and_commands.sql
Created March 26, 2018 18:52 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
library(reshape2)
library(ggplot2)
library(scales)
# read in data
setwd("~/Google Drive")
poll<-read.csv("England_pollutants.csv")
# time between start and end
poll$Start.Date2<-strptime(poll$Start.Date, format="%d/%m/%y")
@markocherrie
markocherrie / server.R
Last active November 23, 2015 22:01
ISS_shiny_app_server
library(dygraphs)
# ISS data import
df<-read.csv("ISS Passes Overhead - Sheet1.csv", header=FALSE)
df$datetime<-strptime(df$V1," %B %d,%Y at %I:%M %p")
df$datetime<-as.POSIXct(df$datetime,tz = "GMT")
df$date<-strptime(df$V1," %B %d,%Y")
ISS <- xts(df$V3,order.by=df$datetime,frequency=365)
# shiny output
@markocherrie
markocherrie / ui.R
Created November 23, 2015 21:00
ISS_shiny_app_iu
library(shinythemes)
shinyUI(fluidPage(
theme = shinytheme("cosmo"),
mainPanel(
dygraphOutput("dygraph")
)
)
)
@markocherrie
markocherrie / openair.R
Created November 20, 2015 13:03
uploading code to blogger test
library(openair)
Edinburgh = importAURN(site = 'ED3', year = 2015)
calendarPlot(Edinburgh, pollutant = "o3")