Skip to content

Instantly share code, notes, and snippets.

@chrishokamp
chrishokamp / add_corns.js
Last active February 16, 2021 13:04
add some unicorns to your life -- paste this into console
var _loadScript = function(path, callback){ var script= document.createElement('script'); script.type= 'text/javascript'; script.src= path; document.head.appendChild(script); setTimeout(function() {callback();}, 5000); }; var draw = function() {var func = document.createElement('script'); func.type='text/javascript';var f='for (var i=20; i>0; i -= 1) { cornify_add(); }';func.innerText = f;document.head.appendChild(func);}; _loadScript('https://www.cornify.com/js/cornify.js', draw);
@chrishokamp
chrishokamp / cut_cols.awk
Created October 15, 2013 15:53
simple awk to cut out some columns from a .csv
awk 'BEGIN{OFS=FS=","}
{print $2, $5 }
' "file.csv" > output.csv
@chrishokamp
chrishokamp / add_index_col.sh
Created October 17, 2013 11:17
add a numbered index column to a .csv using sed
sed = test_csv.csv | sed 'N;s/\n/,/'
@chrishokamp
chrishokamp / injecting $http in the console
Created December 11, 2013 00:24
how to inject $http into the console for an Angular app
var $inj = angular.injector(['App']);
var serv = $inj.get('$http');
var x = serv({method: 'POST', url: 'http://127.0.0.1:5000'}).success(function(data){console.log(data)}).error(function(data, status, header){ console.log(data); console.log(status); console.log(header);});
console.log(x);
@chrishokamp
chrishokamp / mlp.py
Created March 24, 2014 19:46 — forked from amueller/mlp.py
import numpy as np
import warnings
from itertools import cycle, izip
from sklearn.utils import gen_even_slices
from sklearn.utils import shuffle
from sklearn.base import BaseEstimator
from sklearn.base import ClassifierMixin
from sklearn.preprocessing import LabelBinarizer
@chrishokamp
chrishokamp / gensim_vector_space_notebook.json
Last active August 29, 2015 14:01
gensim lda, hierarchical lda, and lsi demo
{
"metadata": {
"name": "gensim_tutorial"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@chrishokamp
chrishokamp / install_anaconda.sh
Last active October 11, 2015 18:40
install the anaconda scientific python distribution
# install the anaconda python distribution
echo 'grabbing the distro, note that you need to accept the license...'
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh
bash Anaconda*.sh
echo "all done, have a great day $USER"
@chrishokamp
chrishokamp / sync_with_upstream.sh
Last active August 29, 2015 14:07
how to add an upstream remote, and pull from upstream
# cd into your top level directory ml-group/
# add a remote called 'upstream'
git remote add upstream https://github.com/dcumachinelearning/ml-group.git
# pull from upstream
git pull upstream master
# push the new commits from upstream to your fork on github
git push
@chrishokamp
chrishokamp / fracking-puns.txt
Created November 4, 2014 12:36
these words are good candidates for making puns about fracking
fraternize
sassafras's
frankish
franjo
refractor
frannie
infractions
frantically
frankfurters
frantically
@chrishokamp
chrishokamp / grab_images.py
Created November 12, 2014 14:41
grab the images at a url
#!/usr/bin/python
#Author: Chris Hokamp
#Spring 2013
import sys
import requests
from BeautifulSoup import BeautifulSoup
import re
if len(sys.argv) != 4: