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
Last active October 10, 2016 00:16
Parsey McParseface + API + django + dockerfile https://github.com/dan-nadler/ParseyAPI.git
FROM brianlow/syntaxnet
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
libfreetype6-dev \
libpng12-dev \
libzmq3-dev \
@johndpope
johndpope / setup-tensorflow.sh
Created October 10, 2016 01:44 — forked from albertstartup/setup-tensorflow.sh
setup tensorflow on aws
#!/bin/bash
set -o nounset
set -o errexit
git clone https://github.com/tensorflow/tensorflow
sudo apt-get install -y openjdk-8-jdk libcurl4-openssl-dev python3-numpy swig python3-dev python3-pip python3-setuptools zlib1g-dev
echo "deb http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
FROM ubuntu:14.04
MAINTAINER Jeremiah Harmsen <[email protected]>
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libfreetype6-dev \
libpng12-dev \
@johndpope
johndpope / group-by-ip.sql
Created October 11, 2016 17:50 — forked from bennadel/group-by-ip.sql
Grouping The MySQL PROCESSLIST By IP Address To View Connection Counts
SELECT
tmp.ipAddress,
-- Calculate how many connections are being held by this IP address.
COUNT( * ) AS ipAddressCount,
-- For each connection, the TIME column represent how many SECONDS it has been in
-- its current state. Running some aggregates will give us a fuzzy picture of what
-- the connections from this IP address is doing.
FLOOR( AVG( tmp.time ) ) AS timeAVG,
@johndpope
johndpope / mysql_kill_queries.sql
Created October 11, 2016 17:55 — forked from ffeast/mysql_kill_queries.sql
Mysql kill queries
/* run \. /tmp/mysql_victims.txt after executing this query */
SELECT
concat('KILL ', id, ';')
FROM
information_schema.processlist
WHERE
user='victim' AND time > 60
INTO OUTFILE '/tmp/mysql_victims.txt';
@johndpope
johndpope / buildAllContainers.sh
Created October 18, 2016 20:49
swift server docker
#!/bin/bash
#Don't forget to do a 'chmod + buildAllContainers.sh'
# function to open a new terminal tab and run commands (for Apple Terminal or iTerm)
open_tab() {
[ $# -lt 1 ] && return
if [ "$TERM_PROGRAM" == "Apple_Terminal" ]
then
osascript -e "
'tell application \"Terminal\"
@johndpope
johndpope / install-tensorflow.sh
Created October 19, 2016 14:00 — forked from erikbern/install-tensorflow.sh
Install TensorFlow on EC2
# Start from ami-763a311e
# Install various packages
sudo apt-get update
sudo apt-get upgrade -y # choose “install package maintainers version”
sudo apt-get install -y build-essential python-pip python-dev git python-numpy swig python-dev default-jdk zip zlib1g-dev
# Install Bazel
git clone https://github.com/bazelbuild/bazel.git
cd bazel
mkdir ~/projects
cd ~/projects
git clone --recurse-submodules https://github.com/petewarden/tensorflow_ios.git tensorflow_ios
cd tensorflow_ios
mkdir tools
mkdir tools/objc
echo '
filegroup(
name = "default_provisioning_profile",
srcs = ["default_provisioning_profile.mobileprovision"],
@johndpope
johndpope / makeGetCall
Created October 20, 2016 16:05 — forked from cmoulton/URLSession Calls in Swift 3.0.1
URLSession Get Call in Swift 3.0
func makeGetCall() {
// Set up the URL request
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
guard let url = URL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = URLRequest(url: url)
// set up the session
@johndpope
johndpope / gist:0ea4e4eb230630f68063755a9ec8e990
Created October 20, 2016 19:30
Swift3 docker container
Pull the Docker Image From Docker Hub:
docker pull swiftdocker/swift
docker run --privileged -i -t --name swiftfun swiftdocker/swift:latest /bin/bash