Skip to content

Instantly share code, notes, and snippets.

@wimsy
wimsy / aad_reporting_api_signins.R
Last active March 16, 2018 12:14
R functions to authenticate with and query the Azure Active Directory reporting API for sign-in data.
# aad_reporting_api_signins.R
# Functions to authenticate with Azure AD by OAuth and query signing data from
# Microsoft's Azure AD Reporting API: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-reporting-api-getting-started-azure-portal
# To get a client_id and client_secret, you must register an AAD application
# with appropriate permissions: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-reporting-api-prerequisites-azure-portal
#
# Example usage:
#
# signins <- query_days(ymd("2018-03-01"), ymd("2018-03-07"), save_as_RDS = T)
#
@wimsy
wimsy / randomized_timer.py
Created February 27, 2015 18:05
Randomized timer for Pythonista that hands off the random choice as well as the number of seconds elapsed to a Workflow - https://workflow.is/workflows/813286b8841d4688945f7c2bbdff74db
# randomized_timer.py
#
# A simple app to conduct randomized time trials based on the Stopwatch.py
# sample app in [Pythonista](http://omz-software.com).
#
# This script takes an array of choices (strings) and randomly selects one on
# launch in Pythonista. You then tap the screen to start a stopwatch and tap it
# again to stop it. When you tap it a third time, the choice presented to you
# plus the elapsed time in seconds are added to a callback URL to call a
# separate script in the iOS [Workflow](https://workflow.is/) app for further
@wimsy
wimsy / helpers.R
Created October 11, 2014 12:28
just learning about shiny sharing options - nothing to see here
if (!exists(".inflation")) {
.inflation <- getSymbols('CPIAUCNS', src = 'FRED',
auto.assign = FALSE)
}
# adjusts yahoo finance data with the monthly consumer price index
# values provided by the Federal Reserve of St. Louis
# historical prices are returned in present values
adjust <- function(data) {

Keybase proof

I hereby claim:

  • I am wimsy on github.
  • I am wimsy (https://keybase.io/wimsy) on keybase.
  • I have a public key whose fingerprint is 1747 02F9 C04A 41F7 B272 2957 E769 8ACD EDC4 CD79

To claim this, I am signing this object:

@wimsy
wimsy / OpenPaths Map Data Prep.ipynb
Created August 27, 2013 10:21
iPython notebook to prep OpenPaths data for export to CartoDB with some analysis.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wimsy
wimsy / merge_json_files.py
Last active December 17, 2015 23:09
This is a quick command line executable script to merge two JSON files. It takes the two files plus a name for the output file as arguments, loads the two files, combines their data, removes duplicates, then writes the output to the designated output file. I wrote this to help me manage my personal location data tracked at [OpenPaths](https://op…
#!/usr/local/bin/python
'''
This utility takes three arguments from the command line: file1, file2
and outfile. Assuming these are JSON files, it parses them, merges
the two lists (removing duplicates), then writes the merged list to
the outfile.
'''
import json
import datetime
import pytz
import requests
import time as time_mod
FORECAST_TEMPLATE = 'https://api.forecast.io/forecast/{apikey}/{latitude},{longitude}{time}'
class Forecast(object):
@wimsy
wimsy / Weight_Analysis_First_Pass.ipynb
Created November 21, 2012 02:56
My first attempt to use iPython to dissect some old weight data...
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.