Skip to content

Instantly share code, notes, and snippets.

View wassname's full-sized avatar
🙃

Michael J Clark wassname

🙃
View GitHub Profile
@wassname
wassname / ascii_trie.py
Last active February 4, 2016 08:50
Visualize a list of search suggestions as an ascii trie.
"""
Visualize a list of search suggestions as an ascii trie.
Inputs:
- searches: a list of strings, each representing a sentance
Usage:
>>>searches=[
'online calculator',
'online photo editor',
@wassname
wassname / jquery-canvasFlame.js
Last active February 23, 2016 03:53
jQuery plugin to generate flame on a canvas element. Demo: http://codepen.io/wassname/pen/KVOKNe
/**
* @name Flame
* @description jquery plugin to generate flame on a canvas element.
* Based on http://codepen.io/jackrugile/pen/Jbnpv
* @copyright (c) 2015 wassname
* @license: MIT
*/
;(function ( $, window, document, undefined ) {
var pluginName = "flame";
@wassname
wassname / invertByMany.js
Last active March 8, 2016 02:47
invertByMany
// use lodash and es6 to invert a Object by subvalues. This let's you catalouge subvalues by keys
/**
* inverts a object by many values
* e.g. invertByMany({ 'a': [1,2,3], 'b': [1], c:[2]})
* // {"1":["a","b"],"2":["a","c"],"3":["a"]}
**/
var invertByMany=(dataObj)=>
_.transform(dataObj, (result, values, key)=>
_.map(values,subvalue=>
@wassname
wassname / Javascript_random_string_one_liner.js
Created April 15, 2016 06:49
Javascript_random_string_one_liner
// using Math.random
Math.random().toString(36).slice(2)
// => "j9ix7gr3xw7iiww8nqkh5b3xr"
@wassname
wassname / segpy_read_writer.py
Last active April 21, 2016 01:45
Using segypy to read large files by assuming they have a fixed layout
"""
See: https://github.com/sixty-north/segpy/issues/29
This iherits it licence from segpy
This is for segpy commit: 91562fd
"""
import os
import sys
root = os.path.dirname(os.path.dirname(__file__))
segpy_path=os.path.join(root,'segpy')
@wassname
wassname / inject_scripts.js
Last active July 25, 2016 02:16
Snippet to inject jquery etc into page
/**
Put links to injectable scripts in the cdns array. Try searching on cdnjs.com
but if you need the latest you can use the github version via https://rawgit.com/.
This start with // so they word on https and http.
They are not minified so comment are visible during development.
**/
var cdns = [
/* polyfill */
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wassname
wassname / pick_image features.ipynb
Created August 12, 2016 00:07
example of interactive labeling images in jupyter/ipython notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wassname
wassname / fbmtimelinecleaner.js
Created June 8, 2014 02:34
Facebook Mobile Timeline Cleaner. Take back control of your Facebook Timeline with this activity log scrubber! This script deletes your facebook comments/posts/likes etc.
// ==UserScript==
// @name Facebook Mobile Timeline Cleaner
// @namespace https://github.com/wassname/fbmtimelinecleaner
// @include https://*m.facebook.com/*/allactivity*
// @require http://code.jquery.com/jquery-1.8.3.min.js
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @version 0.40
// ==/UserScript==
@wassname
wassname / dataset_cmudict.py
Last active November 4, 2016 01:57
Loader for cmudict dataset (CMU Pronouncing Dictionary) for keras
"""
Load cmudict/CMU Pronouncing Dictionary as a dataset for keras
author: wassname
url : https://gist.github.com/wassname/ce0ac72c50832b0a27e67bd97ba36080
"""
from keras.utils.data_utils import get_file
from sklearn.model_selection import train_test_split
import numpy as np