This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import json | |
import time | |
import shelve | |
import urllib | |
import urllib.request | |
DB = 'flights' | |
API = "http://www.flightradar24.com/zones/full_all.json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "npm builder", | |
"version": "1.0.0", | |
"description": "A basic npm build pipeline.", | |
"main": "index.html", | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"bourbon": "4.3.4", | |
"bourbon-neat": "2.0.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Needs `, results='asis'` and two spaces before the trailing newline | |
```{r occupations_by_vismin.R, echo=TRUE, message=FALSE, warning=FALSE, results='asis'} | |
for(thing in list_of_things){ | |
cat("\n###", thing, "\n") | |
cat(" \n") | |
} | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After editing .gitignore to match the ignored files, you can do git ls-files -ci --exclude-standard to see the files that are included in the exclude lists; you can then do git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached to remove them from the repository (without deleting them from disk). | |
Edit: You can also add this as an alias in your .gitconfig file so you can run it anytime you like. Just add the following line under the [alias] section: | |
apply-gitignore = !git ls-files -ci --exclude-standard -z | xargs -0r git rm --cached | |
(The -r flag in xargs prevents git rm from running on an empty result and printing out its usage message.) | |
Now you can just type git apply-gitignore in your repo, and it'll do the work for you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load required packages | |
load_requirements <- function(pkg){ | |
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] | |
if (length(new.pkg)) | |
install.packages(new.pkg, dependencies = TRUE) | |
sapply(pkg, require, character.only = TRUE) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import csv | |
from datetime import datetime | |
file_out = 'sunrise_sunset_toronto.csv' | |
base_url = 'https://www.timeanddate.com/sun/canada/toronto?month=5&year=2018' | |
base_city = 'toronto' | |
base_year = '2017' | |
root_el_id = 'as-monthsun' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################## | |
# Get sunrise, sunset and dusk times for a location | |
################################################## | |
days <- seq(from = as.POSIXct("2017-01-01"), to = as.POSIXct("2017-12-31"), by = "days") | |
# coordinates for Toronto | |
lat <- 43.6532 | |
lon <- -79.3832 | |
coord <- matrix(c(lon, lat), nrow = 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# History files | |
.Rhistory | |
.Rapp.history | |
# Session Data files | |
.RData | |
# Example code in package build process | |
*-Ex.R |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eth302_takeoff$time <- as.POSIXct(eth302_takeoff$time, format = "%Y-%m-%d %H:%M:%S", tz="GMT") | |
eth302_takeoff$time_EAT = with_tz(eth302_takeoff$time, tzone = "Africa/Addis_Ababa") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OSX Finder junk | |
.DS_Store | |
# environment variables incl. credentials | |
.env | |
# python virtual environments | |
.venv | |
venv |