Skip to content

Instantly share code, notes, and snippets.

View johndpope's full-sized avatar

John D. Pope johndpope

View GitHub Profile
FROM ubuntu:14.04
MAINTAINER Jeremiah Harmsen <jeremiah@google.com>
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 / Dockerfile
Last active October 19, 2016 20:51
Parsey McParseface - API Dockerfile (osx needs heaps of RAM) https://github.com/dsindex/syntaxnet
# Use this docker-compose.yml file to start services.
# https://github.com/johndpope/DockerParseyAPI
# https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/Dockerfile.devel
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/Dockerfile.devel-gpu
FROM gcr.io/tensorflow/tensorflow:latest-devel
@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
@johndpope
johndpope / Package.swift
Created October 21, 2016 16:12
Alamofire Package.swift (linux)
import PackageDescription
let package = Package(
name: "SPMTester",
dependencies: [
.Package(
url: "../Alamofire",
"4.0.2"
)
]