Skip to content

Instantly share code, notes, and snippets.

Avatar
🥑
avocado

Ryan Bateman ryanbateman

🥑
avocado
  • London, United Kingdom
View GitHub Profile
@ryanbateman
ryanbateman / ddg.R
Created January 20, 2022 09:59
R script for visualising play store review keywords over time
View ddg.R
library(jsonlite)
library(dplyr)
require(ggplot2)
library(data.table)
library(lubridate)
library(dplyr)
library(tidyr)
library(reshape2)
library(data.table)
@ryanbateman
ryanbateman / ddg.ipyb
Created January 20, 2022 09:55
DDG Jupyter notebook for exporation
View ddg.ipyb
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "235a092e",
"metadata": {
"scrolled": true
},
"outputs": [],
View gist:8d2bb1e058508927d251061f8634c86d
Assumptions:
All interactions with the service is over SMS
There is no other interaction with any other users other than the updated temperatures or names
No phone numbers will be sent over SMS _ever_
All data sent over the service is low-stakes, low security information (?!) - names, temperatures and associations - that people would be fine publicly sharing if it came to it (because it is, to some extent, public as described)
Basic rules:
A USER is a phone number, desired name, and their most recent UPDATE
An UPDATE is the temperature and time a USER took it
A USER creates an UPDATE by sending their temperature to the service
@ryanbateman
ryanbateman / pihole.1m.py
Last active September 1, 2021 02:06
An extension to the bitbar Pihole plugin to add a sparkline showing the last 3 hours worth of ads blocked
View pihole.1m.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <bitbar.title>Pi-hole status</bitbar.title>
# <bitbar.version>v3.1</bitbar.version>
# <bitbar.author>Felipe Martin</bitbar.author>
# <bitbar.author.github>fmartingr</bitbar.author.github>
# <bitbar.author>Siim Ots</bitbar.author>
# <bitbar.author.github>siimots</bitbar.author.github>
# <bitbar.author>Ryan Bateman</bitbar.author>
# <bitbar.author.github>ryanbateman</bitbar.author.github>
@ryanbateman
ryanbateman / trees.R
Created November 6, 2019 16:40
NYC Tree Census 2015
View trees.R
require("ggplot2")
require("viridis")
require("colorBrewer")
require("randomcoloR")
trees <- read.csv("trees.csv")
trees$health <- factor(trees$health)
trees$spc_common <- factor(trees$spc_common)
colours <- sample(grDevices::colors()[grep('gr(a|e)y', grDevices::colors(), invert = T)], length(trees$spc_common))
@ryanbateman
ryanbateman / carbonra.r
Created February 4, 2019 08:01
A short script which shows how to calculate carbon cost of a flight, given data from Monzo's API using Monzor (the R library I wrote)
View carbonra.r
library(monzor)
library(geosphere)
library(ggrepel)
library(ggmap)
# For the purposes of this demo, I picked the relevant transcation by hand. Using Monzo's callbacks, this would be automated in live code
getFlight <- function() {
getTransaction(transactionId = "tx_0000AAAAA5i3BqkXSPAAAA")
}
@ryanbateman
ryanbateman / NoText.user.js
Last active December 12, 2017 16:31
A simple greasemonkey script to make all text on a website invisible
View NoText.user.js
// ==UserScript==
// @name NoText
// @version 0.2
// @namespace com.everythinginthesky
// @description Makes the web bearable
// @author @rynbtmn
// @match *://*/*
// ==/UserScript==
function addGlobalStyle(css) {
@ryanbateman
ryanbateman / monzo_auth_example.R
Last active November 19, 2017 19:24
How to auth against Monzo's API in R
View monzo_auth_example.R
library(httr)
library(jsonlite)
# OAuth settings for Monzo:
# https://monzo.com/docs/#authentication
monzo <- oauth_endpoint(
authorize = "https://auth.getmondo.co.uk/",
access = "https://api.monzo.com/oauth2/token")
# You need to set up your own Monzo 'app' to play with the API
@ryanbateman
ryanbateman / unfliptable.coffee
Last active June 30, 2016 13:49
Hubot "Unflip a table" script
View unfliptable.coffee
# Description:
# Listen for any table flips, clean up afterwards
#
# Author:
# @rynbtmn
module.exports = (robot) ->
robot.hear /┻━┻/i, (res) ->
res.send "┬─┬ノ( º _ ºノ)"
View gist:9eef2b45d84ad7c18bbc
### Keybase proof
I hereby claim:
* I am ryanbateman on github.
* I am ryanbateman (https://keybase.io/ryanbateman) on keybase.
* I have a public key whose fingerprint is 28BD 3445 A837 A715 BB9E 0699 7320 CC6E 330F C2A1
To claim this, I am signing this object: