Skip to content

Instantly share code, notes, and snippets.

@kylekyle
kylekyle / titanic.ipynb
Created April 20, 2020 17:31
titanic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylekyle
kylekyle / using-aquamentus-to-train-neural-networks.ipynb
Last active April 11, 2020 17:14
Using Aquamentus to Train Neural Networks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylekyle
kylekyle / onion_search.rb
Last active March 26, 2020 19:17
Search the Common Crawl for dark web domains
# a few flags will make this run a skosh faster:
# jruby -0 -J-Xmn512m -J-Xms2048m -J-Xmx2048m -J-server onion_search.rb
# For details on reading WARC records:
# https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.0/#file-and-record-model
require 'csv'
require 'fileutils'
# using java for two reasons: Java has native threads
# and Java's gzip reader supports concatenated zips
@kylekyle
kylekyle / digital_picture_frame.rb
Created March 17, 2020 18:34
Prep pictures for display on a VIEWline widescreen digital picture frame
# Prep pictures for display on a VIEWline widescreen digital picture frame
# - The file types Google Photo dumped out: heic, mov, jpg, mp4
# - To check that you don't have any others:
# > Dir.entries('.').reject{|f| f.start_with? '.'}.map(&:downcase).map{|f| File.extname f}.uniq
# - Recommend doing orientation adjustments before exporting
require 'mini_magick'
require 'securerandom'
files = Dir.entries('.').select do |file|
@kylekyle
kylekyle / blackjack-agent.ipynb
Last active March 6, 2020 18:29
keras-rl based deep q-learning agent using OpenAI Gym’s Blackjack-v0 environment that runs in Google Colab.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylekyle
kylekyle / urllib.py
Last active February 11, 2020 23:35
urllib parsing
import pandas as pd
from urllib.parse import urlparse
df = pd.read_csv("onions.txt", names=["domain"])
df[df["domain"].apply(lambda x: urlparse("http://"+x).netloc).duplicated(keep=False) == True]
@kylekyle
kylekyle / sync_grades.rb
Created December 13, 2019 16:29
Canvas -> AMS with Watir
require 'csv'
require 'watir'
raise "Need a TSV with grades!" if ARGV.empty?
puts "Navigate to your Grade Book to continue ...";
browser = Watir::Browser.new :chrome, :switches => %w[--log-level=3 --test-type]
browser.goto 'https://apps.westpoint.edu/ams/main.cfm'
browser.wait_until(timeout: 3600) { browser.title[/Grade Book/] }
@kylekyle
kylekyle / pogo.rb
Last active May 10, 2019 03:02
Make your pictures compatible with the Polaroid Pogo. And preview what they will look like. And add cute white borders.
# Prep pictures for printing on a Polaroid Pogo
require 'mini_magick'
pogo_path = File.join(Dir.pwd,'pogo')
Dir.mkdir pogo_path unless File.exists? pogo_path
ARGV.each_with_index do |path,i|
next if File.directory? path
puts "Processing #{path} ..."
@kylekyle
kylekyle / Key Pad Generator.ipynb
Created April 23, 2019 18:25
Use simulated annealing to generate a random keypad
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylekyle
kylekyle / README.md
Last active March 31, 2019 17:02
Call or Text a Ruby Script

The specific instructions are for Mac OS X, but it should run on any platform that supports Asterisk and Ruby.

$ brew tap preetsethi/homebrew-asterisk
$ cd /usr/local/Homebrew/Library/Taps/leedm777/homebrew-asterisk
$ sed -i .bak 's/EOS.unindent/EOS/g' asterisk.rb turn-wireshark.rb
$ brew install asterisk