Skip to content

Instantly share code, notes, and snippets.

View johndpope's full-sized avatar

John D. Pope johndpope

View GitHub Profile
@johndpope
johndpope / Dockerfile
Created September 28, 2017 15:27 — forked from ultimateprogramer/Dockerfile
Dockerfile to install supervisor over Ubuntu Image
FROM ubuntu:latest
MAINTAINER Ahmed Maawy
# Run updates
RUN apt-get update --fix-missing && apt-get install -y
# Install Curl
RUN apt-get install curl -y
# Install supervisor
@johndpope
johndpope / google-ngrams_2grams-to-5grams_without-punctuation.txt
Created October 4, 2017 23:23 — forked from gagliardetto/google-ngrams_2grams-to-5grams_without-punctuation.txt
Calculate the uncompressed size of remote gzip files by downloading them, unzipping to stdin and counting bytes.
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-a_.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-aa.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ab.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ac.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ad.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ae.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-af.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ag.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ah.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ai.gz
extension CGPoint : Hashable {
func distance(point: CGPoint) -> Float {
let dx = Float(x - point.x)
let dy = Float(y - point.y)
return sqrt((dx * dx) + (dy * dy))
}
public var hashValue: Int {
// iOS Swift Game Development Cookbook
// https://books.google.se/books?id=QQY_CQAAQBAJ&pg=PA304&lpg=PA304&dq=swift+CGpoint+hashvalue&source=bl&ots=1hp2Fph274&sig=LvT36RXAmNcr8Ethwrmpt1ynMjY&hl=sv&sa=X&ved=0CCoQ6AEwAWoVChMIu9mc4IrnxgIVxXxyCh3CSwSU#v=onepage&q=swift%20CGpoint%20hashvalue&f=false
return x.hashValue << 32 ^ y.hashValue
###From an Ubuntu 16.04 Instance with 20GB of HD space
###Update Ubuntu
sudo apt-get update
sudo apt-get -y upgrade
###Download Nvidia Software
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
@johndpope
johndpope / cuda-setup.sh
Created August 14, 2018 19:03 — forked from cVeqT2vkiSX5kJVJxcVmz7rKHKbu9M9FNixoPNC/cuda-setup.sh
Setup script for Amazon EC2 GPU cracking with cudaHashcat
#!/bin/bash
#set -x
readonly progname=$(basename $0)
readonly ARGS="$@"
#see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
mydate=$(date +"%Y%m%d-%H%M")
S3BUCKET="camelinc-cracking"
@johndpope
johndpope / setup_aws_gpu.sh
Last active August 17, 2018 20:19 — forked from mlgill/setup_aws_gpu.sh
Setup AWS GPU instance - bump 9.2.148
#!/bin/bash
####################################################################################
## AWS GPU Instance Setup Script ##
## John Pope ##
## ##
## Gist location: https://gist.github.com/johndpope/ac3ae5f4e033d1ca6c94d3387e4dc309 ##
## Date updated: 2018/08/17 ##
####################################################################################
@johndpope
johndpope / executionTimeInterval.swift
Created September 6, 2018 14:32 — forked from kristopherjohnson/executionTimeInterval.swift
Calculate execution time for a block of Swift code
import QuartzCore
func executionTimeInterval(block: () -> ()) -> CFTimeInterval {
let start = CACurrentMediaTime()
block();
let end = CACurrentMediaTime()
return end - start
}
#!/usr/bin/env python
# Based on https://www.openwall.com/lists/oss-security/2018/08/16/1
# untested CVE-2018-10933
import sys, paramiko
import logging
username = sys.argv[1]
hostname = sys.argv[2]
command = sys.argv[3]
@johndpope
johndpope / Gemfile-0.39.rb
Created December 7, 2018 03:14 — forked from brennanMKE/Gemfile-0.39.rb
Gemfiles for CocoaPod Versions
source 'https://rubygems.org'
gem 'cocoapods', '~> 0.39.0'
#gem 'cocoapods', :git => 'https://github.com/CocoaPods/CocoaPods.git', :branch => '0.39-stable'
gem 'activesupport', '< 5'
@johndpope
johndpope / detweet.swift
Created January 16, 2019 16:45 — forked from mxcl/detweet.swift
Delete all tweets and favorites older than two months ago. Instructions in comment.
#!/usr/bin/swift sh
import Foundation
import PromiseKit // @mxcl ~> 6.5
import Swifter // @mattdonnelly == b27a89
let swifter = Swifter(
consumerKey: "FILL",
consumerSecret: "ME",
oauthToken: "IN",
oauthTokenSecret: "https://developer.twitter.com/en/docs/basics/apps/overview.html"