Skip to content

Instantly share code, notes, and snippets.

View kkleidal's full-sized avatar

Ken Leidal kkleidal

  • Genesis Therapeutics
  • Boston, MA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kkleidal on github.
  • I am kkleidal (https://keybase.io/kkleidal) on keybase.
  • I have a public key whose fingerprint is 5E4D 0F74 409A 819C A9F6 9DCE 22CA 77A0 6662 88BD

To claim this, I am signing this object:

@kkleidal
kkleidal / example.py
Created November 17, 2017 19:55
Matplotlib Image Summaries in Tensorboard
import tensorflow as tf
import io
import matplotlib.pyplot as plt
import numpy as np
import scipy as scipy # Ensure PIL is also installed: pip install pillow
'''
matplotlib_summary code:
Code for generating a tensorflow image summary of a custom matplotlib plot.
package main
import (
"log"
"strings"
"time"
)
type threadPoolWorker struct {
free chan *threadPoolWorker
import subprocess
import base64
def keyscan(host):
p = subprocess.Popen(['/bin/sh', '-c', '(ssh-keyscan %s | grep ssh-rsa) 2>/dev/null' % host], stdout=subprocess.PIPE)
config = p.stdout.read().decode('ascii').split(' ')
p.wait()
if p.returncode != 0:
raise Exception("Could not scan %s for SSH key." % host)
config[2] = paramiko.RSAKey(data=base64.b64decode(config[2]))
@kkleidal
kkleidal / example.py
Last active November 25, 2016 04:01
For executing long-running ML jobs
import gensim
from job import Job
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
# Load Google's pre-trained Word2Vec model.
# model = gensim.models.Word2Vec.load_word2vec_format('./data/GoogleNews-vectors-negative300.bin', binary=True)
def pca_plot(points, training_points=None):
@kkleidal
kkleidal / mailer.js
Created July 25, 2016 20:47
Send Mail via SMTP with Node
/* jshint node: true */
"use strict";
var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
var transporter = nodemailer.createTransport({
host: "smtp.zoho.com",
// port: 587,
secure: true,
@kkleidal
kkleidal / install-hook.sh
Created July 24, 2016 19:35
Express.js linting and beautifying pre-commit hook
#!/bin/sh
ln -s $(pwd)/pre-commit.bash .git/hooks/pre-commit
@kkleidal
kkleidal / image_metadata.swift
Last active August 18, 2016 12:00
Strip location/date metadata from photo library photo asset imported with FDTake
private var xifDateFormatter: NSDateFormatter = { () -> NSDateFormatter in
let dateFormatter = NSDateFormatter()
dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.dateFormat = "yyyy:MM:dd' 'HH:mm:ss"
dateFormatter.timeZone = NSTimeZone(abbreviation: "UTC")
return dateFormatter
}()
// ...
@kkleidal
kkleidal / .gitignore
Created March 27, 2016 16:43
Latex Helper Files
*.pdf
*.log
*.aux
*.out
### Keybase proof
I hereby claim:
* I am kkleidal on github.
* I am kkleidal (https://keybase.io/kkleidal) on keybase.
* I have a public key ASCMLGKNvE2sMm4iKxH2xGNwsLTQInAiVe0ffuQPZwgwgwo
To claim this, I am signing this object: