Skip to content

Instantly share code, notes, and snippets.

@wheresalice
wheresalice / Makefile
Last active May 6, 2019 17:26
unistd read() overflow
test:
gcc test.c -o test
@wheresalice
wheresalice / jira_prediction.r
Created April 24, 2019 16:48
Take a MySQL export of Jira ticket count per day, use Facebook's Prophet library to predict the next year, and then graph that.
library(prophet)
# mysql -e "select distinct(CAST(CREATED AS DATE)) C, COUNT(*) from jira.jiraissue WHERE project=1 AND reporter='alice' group by C;" -N -B > jira.txt
jira <- read.delim('jira.txt', header=FALSE)
dates <- as.POSIXct(strptime(jira$V1, "%Y-%m-%d"))
jira_with_dates <-data.frame(dates, jira['V2'])
names(jira_with_dates) = c("ds", "y")
@wheresalice
wheresalice / Leeds Food.md
Created February 9, 2019 15:27
I took your recommendations and collated a list of Leeds food recommendations
@wheresalice
wheresalice / backup.sh
Last active January 8, 2019 15:37
Backup your github repos to Bitbucket
# Usage: change username:password to either an app-password or your actual password
# Change WheresAlice to your actual username on Bitbucket.org
# Run this script from the directory with all your GitHub checkouts in
# @TODO - Due to Mac limitations of 'find' we are listing all files, not just directories
# @TODO - Get a list of GitHub repos and clone them all
# @TODO - Do this for GitLab too
# Replace my_token with a token from https://github.com/settings/tokens and then uncomment this line in order to clone the first 100 of your github repositories
# curl 'https://api.github.com/user/repos?access_token=my_token&affiliation=owner&per_page=100' | gron | grep ssh_url | cut -d'"' -f2 | xargs -I {} git clone {}
@wheresalice
wheresalice / User Growth.png
Last active January 3, 2019 08:51
Predict future growth of your Slack org using R and Facebook's Prophet library
User Growth.png
@wheresalice
wheresalice / yum_repo_test.rb
Last active December 28, 2018 11:01
Test the health of a yum repository, ensuring that the repomd.xml file and linked data files can all be downloaded. Usage: `ruby yum_repo_test.rb http://pkg.jenkins.io/redhat-stable/repodata`
require 'open-uri'
require 'nokogiri'
BASE_PATH = ARGV[0].freeze
@repomd = Nokogiri::XML(open(File.join(BASE_PATH, 'repomd.xml')).read)
def test_path(type)
href = @repomd.xpath("/xmlns:repomd/xmlns:data[@type=\"filelists\"]/xmlns:location").first['href']
full_path = File.join(File.dirname(BASE_PATH), href)
@wheresalice
wheresalice / Chrome.md
Last active September 19, 2018 15:59
Making Chrome more usable

Fix Chrome 69 UI changes:

  • chrome://flags/#omnibox-ui-hide-steady-state-url-scheme-and-subdomains - set to disable to show www. and m.
  • chrome://flags/#top-chrome-md - set to normal to get classic mode

Remove mobile junk:

  • chrome://flags/#enable-ntp-remote-suggestions - set to Disabled to hide content suggestions on the new tab page
  • chrome://flags/#enable-ntp-bookmark-suggestions - set to Disabled to hide bookmarks on the new tab page
  • chrome://flags/#enable-ntp-suggestions-notifications - set to Disabled to not get notifications about new content
@wheresalice
wheresalice / Dockerfile
Created September 7, 2018 14:12
papermill dockerfile. This technically works, but since notebooks don't have a way of declaring dependencies this is almost certainly going to fail on most notebooks
FROM python:3
RUN pip install papermill ipykernel
VOLUME /tmp/workdir
WORKDIR /tmp/workdir
ENTRYPOINT ["papermill"]
@wheresalice
wheresalice / Makefile
Created September 7, 2018 10:38
Locally validate a directory of Prometheus rules against version 1.7.1
.PHONY: test
test:
docker run -it --rm -v `pwd`:/tmp -w /tmp --entrypoint=/bin/promtool prom/prometheus:v1.7.1 check-rules *.rules