Skip to content

Instantly share code, notes, and snippets.

require 'rspec'
def captcha(input)
sum = 0
input_str = input.to_s.chars
input_str.each_with_index do |a, b|
sum += a.to_i if input_str[b] == input_str[b - 1]
end
sum
end
@wheresalice
wheresalice / london.ipynb
Created November 26, 2017 14:24
First direct train from Leeds to London, assuming a connecting train from Skipton is required
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Are you having a good day today?
Be gentle with yourself today.
Breakfast and lunch are as important as dinner, so please don't skip them!
Checking privilege...
Congratulate yourself for doing difficult things, even if they might not seem difficult to others.
Do you have a glass of water nearby? Time for a sip!
Don't be afraid to offer hugs. Someone probably needs them.
Don't compare yourself to others, they are not you! You are unique!
Don't forget to eat breakfast! It's important fuel for every adventure.
Go get a drink of water. Stay hydrated!
@wheresalice
wheresalice / README.md
Created November 17, 2017 15:18
Redis-ML Jupyter Notebook

Jupyter notebook for the intro to Redis-ML

Usage:

docker run -it -p 6379:6379 shaynativ/redis-ml
virtualenv .
source bin/activate
pip install jupyter scikit-learn scipy numpy redis
jupyter-notebook
@wheresalice
wheresalice / operationalstops.sh
Last active September 2, 2017 11:40
Passes and operational stops for 2017-09-02 from Darwin schedule data
grep -e "<OPIP" data/20170902020732_v8.xml | grep -oP '(?<=tpl=")[A-Z]+(?=" )' | sort | uniq -c | sort -bgr > tmp/passes.txt
@wheresalice
wheresalice / Dockerfile
Last active July 24, 2017 15:22
Inspec network testing from Docker
FROM chef/inspec
RUN apk add --update netcat-openbsd
@wheresalice
wheresalice / routes.txt
Created July 16, 2017 15:43
Every scheduled train journey in the UK
FROM:TO
ABDARE:BARRYIS
ABDARE:CRDFCEN
ABDARE:PENARTH
ABDARE:PTYPRID
ABDARE:RADYR
ABRCYNS:BARRYIS
ABRCYNS:PENARTH
ABRDEEN:DONC
ABRDEEN:DUNDETB
@wheresalice
wheresalice / play.r
Created June 25, 2017 11:59
R Kafka producer using the Confluent REST Proxy
library(httr)
library(rjson)
# This would ordinarily be on port 8082, but we're going through mitmproxy here for debugging
proxy_uri = "http://localhost:8080"
# Get a list of available topics
get_topics <- function() {
uri <- paste(proxy_uri, "topics", sep="/")
http_topics <- GET(uri)
require 'java'
require 'hive_metastore.jar'
require 'hive_service.jar'
require 'ImpalaJDBC41.jar'
require 'libfb303-0.9.0.jar'
require 'libthrift-0.9.0.jar'
require 'log4j-1.2.14.jar'
require 'ql.jar'
require 'slf4j-api-1.5.11.jar'
require 'slf4j-log4j12-1.5.11.jar'