Skip to content

Instantly share code, notes, and snippets.

View jsimpson's full-sized avatar

Jonathan Simpson jsimpson

View GitHub Profile
#!/usr/bin/env ruby
## disconnect
# ./disconnect.rb -u yourusername [-o /your/path] [-p yourhttpproxyserver]
#
# This is a command-line utility for the bulk-downloading of run data from
# the connect.garmin.com web application, which has lackluster export
# capabilities.
#
@jsimpson
jsimpson / hn_seach.js
Last active September 2, 2015 03:20 — forked from kristopolous/hn_seach.js
hn job query search
function query() {
var
total = 0, shown = 0,
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments);
// This traverses up the dom stack trying to find a match of a specific class
function upTo(node, klass) {
if (node.className === klass) {
@jsimpson
jsimpson / peakdet.m
Created December 14, 2015 18:02 — forked from endolith/peakdet.m
Peak detection in Python
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
@jsimpson
jsimpson / frequency_estimator.py
Created December 14, 2015 18:02 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
from __future__ import division
from scikits.audiolab import flacread
from numpy.fft import rfft, irfft
from numpy import argmax, sqrt, mean, diff, log
from matplotlib.mlab import find
from scipy.signal import blackmanharris, fftconvolve
from time import time
import sys
from parabolic import parabolic
@jsimpson
jsimpson / peakdetect.py
Created December 14, 2015 18:02 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
import numpy as np
from math import pi, log
import pylab
from scipy import fft, ifft
from scipy.optimize import curve_fit
i = 10000
x = np.linspace(0, 3.5 * pi, i)
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 *
np.random.randn(i))
@jsimpson
jsimpson / gist:0e78c489881b15000a9a38a591d01eba
Created June 21, 2016 18:33 — forked from mebens/gist:4218802
Simple glow/bloom GLSL shader for Love2D
// adapted from http://www.youtube.com/watch?v=qNM0k522R7o
extern vec2 size;
extern int samples = 5; // pixels per axis; higher = bigger glow, worse performance
extern float quality = 2.5; // lower = smaller glow, better quality
vec4 effect(vec4 colour, Image tex, vec2 tc, vec2 sc)
{
vec4 source = Texel(tex, tc);
vec4 sum = vec4(0);
@jsimpson
jsimpson / .rubocop.yml
Created November 16, 2016 23:41 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@jsimpson
jsimpson / authentication_with_bcrypt_in_rails_4.md
Created November 18, 2016 02:07 — forked from thebucknerlife/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@jsimpson
jsimpson / Xdefaults.jellybeans
Created March 22, 2017 23:03 — forked from pablox-cl/Xdefaults.jellybeans
Jellybeans color palette for rxvt and xfce4-terminal
# Adjust Rxvt to suit your terminal emulator
# Created with
# ITERM_COLOR_MULTIPLIER=2.5 ./itermcolors2Xdefaults.rb Jellybeans.itermcolors
# https://github.com/richo/jellybeans.vim/blob/c7ff7e9555881a5671fcc8753b381ba142b5ea82/Xdefaults/jellybeans.Xdefaults
Rxvt*color0: #393939
Rxvt*color1: #ca674a
Rxvt*color2: #96a967
Rxvt*color3: #d3a94a
Rxvt*color4: #5778c1
Rxvt*color5: #9c35ac