Skip to content

Instantly share code, notes, and snippets.

View gavinmh's full-sized avatar

Gavin Hackeling gavinmh

View GitHub Profile
// ==UserScript==
// @name Copy Salesforce OmniStudio Form Inputs
// @namespace http://tampermonkey.net/
// @version 1.2
// @description Copy values of all form inputs on the page, including Salesforce OmniStudio forms.
// @author YourName
// @match *://*/*
// @grant GM_setClipboard
// ==/UserScript==
@gavinmh
gavinmh / example.ipynb
Created August 14, 2020 16:31
example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
<html><head><meta charset="utf-8" /></head><body><script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script><script type="text/javascript">/**
* plotly.js v1.43.1
* Copyright 2012-2018, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}(function(){return function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,function(t){return i(e[o][1][t]||t)},u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}}()({
@gavinmh
gavinmh / socks_proxy.sh
Created February 23, 2018 01:42
SOCKS Proxy
ssh -D 1337 -f -C -q -N user@remote -p 22
@gavinmh
gavinmh / psql.md
Created September 5, 2017 02:47 — forked from cimmanon/psql.md
PostgreSQL cheat sheet for MySQL users

I use PostgreSQL via the psql client. If you use a different client (eg. pgAdmin, etc.), I don't know how much will translate over.

One nice difference between psql and mysql (cli) is that if you press CTRL+C, it won't exit the client.

User administration

Login as superuser (via shell)

psql -U postgres
@gavinmh
gavinmh / pil_to_numpy.py
Created July 18, 2017 00:23
PIL to NumPy to PIL
import numpy
import PIL
# Convert Image to array
img = PIL.Image.open("foo.jpg").convert("L")
arr = numpy.array(img)
# Convert array to Image
img = PIL.Image.fromarray(arr)
@gavinmh
gavinmh / download_img.py
Created July 18, 2017 00:15
Download image into buffer
import requests
from PIL import Image
from StringIO import StringIO
r = requests.get('https://example.com/image.jpg')
i = Image.open(StringIO(r.content))
import csv
lines = set()
outfile = open('Train.csv.cr.dedupe', 'wb')
outwriter = csv.writer(outfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
counter = 0
with open('Train.csv.CR_cleaned', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"', skipinitialspace=True)
header = reader.next()
outwriter.writerow(header)
#header {
position: fixed;
}
#TOC {
position: fixed;
margin-top: 100px;
overflow-y: scroll;
height: 80%;
}

Training Data

1 | kmeans process that
3 | the cat
2 | the nexus process that
1 | kmeans that
1 | kmeans process
2 | nexus process
2 | that nexus

3 | cat kmeans the