Skip to content

Instantly share code, notes, and snippets.

View lonnen's full-sized avatar
:shipit:

Lonnen lonnen

:shipit:
View GitHub Profile
tutorial_tests = """
Let's try a simple generator:
>>> def f():
... yield 1
... yield 2
>>> for i in f():
... print i
1
MainThread - Exception raised during socorro.external.hbase.connection_context transaction
Traceback (most recent call last):
File "/data/socorro/application/socorro/database/transaction_executor.py", line 43, in __call__
result = function(connection, *args, **kwargs)
File "/data/socorro/application/socorro/external/hbase/hbase_client.py", line 555, in get_processed_json
number_of_retries=number_of_retries
File "/data/socorro/application/socorro/external/hbase/hbase_client.py", line 191, in f
result = fn(self, *args, **kwargs)
File "/data/socorro/application/socorro/external/hbase/hbase_client.py", line 547, in get_processed_json_as_string
git status # make sure you have no unstaged changes
git checkout master # ensure you're on the master branch
git reset HEAD~15 # removes the last 15 commits, leaves the diff as unstaged changes
git checkout . # deletes all unstaged changes so your repo looks outdated to git
git pull mozilla master # pull all the commits you're missing, bringing you up to date
@lonnen
lonnen / gist:9635489
Last active August 29, 2015 13:57
a quick, simple but not very efficient answer to: https://twitter.com/peterbe/status/446139741902086145
function pySplit(str, sep, num) {
var pieces = str.split(sep)
if (arguments.length < 3) {
return pieces;
}
if (pieces.length < num) {
return pieces;
}
return pieces.slice(0, num).concat(pieces.slice(num).join(sep));
}
@lonnen
lonnen / addkeys.sh
Last active August 29, 2015 13:57
register a bunch of pubkeys with sshcommand. takes 1 arg, a filename where the file contains a username, followed by one or more ssh keys, each on its own line, followed by the next username, and so on
#!/usr/bin/env bash
name="";
key="";
while read line; do
if [[ $line == ssh* ]]; then
key=$line
echo $key | sshcommand acl-add dokku $name
else
@lonnen
lonnen / deploy.sh
Last active August 29, 2015 13:57
a more-or-less updated recipe for deploying the webeng combine back end
git clone git@github.com:lonnen/webeng-2014-puzzles.git
rm -rf /puzzles; cp -r webeng-2014-puzzles /puzzles
git clone git@github.com:lonnen/davis-ci.git
cd davis-ci
git clone git@github.com:lonnen/doozer.git
cd doozer
make build
cd ..
make install
https://assets.mozillalabs.com/Graphics/Wallpapers/Mozilla-is-my-Dinosaur/mozilla-dinosaur_wallpaper_1920x1200.jpg
http://i.imgur.com/HuyRINU.png bg=#e2e2e2
http://blog.seanmartell.com/wp-content/uploads/2013/09/dinosaur.png bg=#e4e4e4
https://farm4.staticflickr.com/3693/12294574244_088c606d68_o_d.png bg=#0076ba
https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB-300dpi.jpg bg=#fff
https://assets.mozillalabs.com/Brands-Logos/Webmaker/mozilla-webmaker_logo-wordmark_RGB.jpg bg=#fff
https://assets.mozillalabs.com/Brands-Logos/Firefox%20Marketplace/logo-wordmark/firefox-marketplace_logo-wordmark_RGB-300dpi.jpg bg=#fff
http://airmozilla-ops1.corpdmz.scl3.mozilla.com/calendar/slide.html
https://assets.mozillalabs.com/Brands-Logos/Firefox/logo-only/firefox_logo-only_RGB-300dpi.jpg bg=#fff
https://farm4.staticflickr.com/3737/9270206141_849b0e4278_o_d.png
# Description:
# rerun a leeroy job
#
# Configuration:
# LEEROY_SERVER
#
# Commands:
# hubot rerun <project> <pull-request-#>
# hubot reroy <project> <pull-request-#>
#
@lonnen
lonnen / curler.sh
Created October 10, 2014 18:23
curl a url forever
# usage: ./curler.sh http://whatever.url.biz
# will run until ctr-C is executed
while [ true ]
do
curl -LI $1
done
if (!window.location.pathname.startsWith('/settings')) {
var garbage = Array.prototype.slice.call(
document.getElementsByClassName('dashboard')
);
garbage.push(
document.getElementsByClassName('trends-inner')[0],
document.getElementsByClassName('wtf-module')[0]
);