Skip to content

Instantly share code, notes, and snippets.

View nonrational's full-sized avatar

Alan Norton nonrational

View GitHub Profile
@nonrational
nonrational / circleci_failed_files.js
Last active January 10, 2020 18:16
Bookmarklet - Copy Failed Test Files in Circle CI to Clipboard
javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}("rspec " + [ ...new Set($('.test-file').map((i,e)=>e.innerHTML)) ].join(' '));
@nonrational
nonrational / emoji_upload_count_by_author.js
Last active January 18, 2018 18:18
Slack Custom Emoji Upload Count (by Author)
// count the number of emojis that each author has uploaded
// to be run in chrome console.
_.countBy($('.emoji_row .author_cell a').map(function(i,e){ return $(e).text().trim(); }))
@nonrational
nonrational / autopush.applescript
Created March 24, 2016 15:16
Viscosity Connect and Duo Push
tell application "Viscosity" to connect "Connection Name w/ Duo Push"
tell application "System Events"
repeat until exists (window "Viscosity" of application process "Viscosity")
delay 0.5
end repeat
tell process "Viscosity"
set value of text field 1 of window "Viscosity" to "push"
delay 1
@nonrational
nonrational / git-prune.sh
Last active September 25, 2015 15:29
git-prune: delete all local branches that have already been merged into the current branch
#!/usr/bin/env bash
git branch --merged | grep -v " develop\| stage\| master" | grep -v '*' | xargs git branch -d
@nonrational
nonrational / ReflectionsHelper.java
Created September 9, 2015 16:08
Suppress WARN org.reflections.Reflections could not create Vfs.Dir from url
package com.betterment.common;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.reflections.vfs.Vfs;
import com.google.common.collect.Lists;
@nonrational
nonrational / time_travel_problems.md
Last active August 29, 2015 14:26
Douglas Adams on Time Travel (The Restaurant at the End of the Universe)

One of the major problems encountered in time travel is not that of accidentally becoming your own father or mother. There is no problem involved in becoming your own father or mother that a broadminded and well-adjusted family can't cope with. ...

The major problem is quite simply one of grammar, and the main work to consult in this matter is Dr Dan Streetmentioner's Time Traveller's Handbook of 1001 Tense Formations. It will tell you for instance how to describe something that was about to happen to you in the past before you avoided it by time-jumping forward two days in order to avoid it. The event will be described differently according to whether you are talking about it from the standpoint of your own natural time, from a time in the further future, or a time in the further past and is further complicated by the possibility of conducting conversations whilst you are actually travelling from one time to another with the intention of becoming your own father or mother.

Most readers get as far as the

@nonrational
nonrational / jenkins_build_ruby_class.rb
Created July 14, 2015 15:09
simple jenkins build wrapper class to fetch parameters
class Build
def initialize(build_json)
@json = build_json
end
def params
if action_node_with_params = @json['actions'].find { |a| a['parameters'] }
action_node_with_params['parameters']
end
end
@nonrational
nonrational / list_available_modules.py
Last active August 29, 2015 14:21
list system and pip-installed modules available to the current python context
import sys as s
for m in s.modules.values():
if hasattr(m, '__file__'):
print(m.__file__)
else:
print(m)
import pip
for p in pip.get_installed_distributions():
if hasattr(p, 'location'):
2015-05-18 16:53:42 -0400
python
setup.py
install
--prefix=/private/tmp/osquery20150518-23111-cgyt8i/third-party/python/
--single-version-externally-managed
--record=installed.txt
running install
@nonrational
nonrational / reverse-tweets.js
Created March 17, 2015 23:02
reverse tweet order on twitter.com
// valid as of 20150317
// run it in chrome's web inspector for easy, top-down reading + screenshots
w = $('.GridTimeline-items'); w.children().each(function(i,li){w.prepend(li)})