Skip to content

Instantly share code, notes, and snippets.

View sthomp's full-sized avatar

Scott Thompson sthomp

View GitHub Profile
@sthomp
sthomp / delete_old_branches.sh
Last active September 24, 2017 14:40
Delete old git branches without deleting develop or master
git branch --merged | grep -v 'master\|develop' | xargs -n 1 git branch -d
@sthomp
sthomp / flickr_style_assemble_data.py
Last active June 29, 2016 06:20
Flickr Style Assemble Data urllib3
#!/usr/bin/env python
"""
Form a subset of the Flickr Style data, download images to dirname, and write
Caffe ImagesDataLayer training file.
"""
import os
import urllib3
import hashlib
import argparse
import numpy as np
@sthomp
sthomp / tsne_plot.py
Created February 17, 2016 03:34
t-SNE plot
def plot_tsne(X_input_pool3, Y_input,n=10000):
indicies = np.random.permutation(X_input_pool3.shape[0])[0:n]
Y=tsne(X_input_pool3[indicies])
num_labels=Y_input[indicies]
labels=classes[num_labels]
df=pd.DataFrame(np.column_stack((Y,num_labels,labels)), columns=["x1","x2","y","y_label"])
sns.lmplot("x1","x2",data=df.convert_objects(convert_numeric=True),hue="y_label",fit_reg=False,legend=True,palette="Set1")
print 'done'
@sthomp
sthomp / serialize_pool3_tensorflow.py
Created February 17, 2016 03:22
Serializing pool_3 weights in TensorFlow
def load_pool3_data():
X_test_file = 'X_test_20160212-00:06:14.npy'
y_test_file = 'y_test_20160212-00:06:14.npy'
X_train_file = 'X_train_20160212-00:06:14.npy'
y_train_file = 'y_train_20160212-00:06:14.npy'
return np.load(X_train_file), np.load(y_train_file), np.load(X_test_file), np.load(y_test_file)
def batch_pool3_features(sess,X_input):
"""
@sthomp
sthomp / aws_es_access_policy
Created December 3, 2015 23:42
Sample elasticsearch access policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
@sthomp
sthomp / kibana_nginx.conf
Last active September 11, 2020 09:08
nginx config to proxy connections to kibana on aws
worker_processes 1;
events {
worker_connections 1024;
}
http{
server {
listen 80;
server_name localhost;
(defn unjoin
"Given a seq `rows` as retrieved from a database select involving a join,
return a vector of nested entities, where the top-level entities have keys
`parent-keys`, plus a key for each key of `child-map`, where the value for
that key is a vector of values specified by the value in `child-map`.
Where the value in `child-map` is a simple keyword, the resulting vector will
contain the corresponding values for that keyword in `rows`.
Eg (unjoin [{:id 1, :a :foo} {:id 1, :a :bar}] [:id] {:vals :a}) =>
@sthomp
sthomp / designer.html
Created July 11, 2014 17:25
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window