Skip to content

Instantly share code, notes, and snippets.

View lonnen's full-sized avatar
:shipit:

Lonnen lonnen

:shipit:
View GitHub Profile
@lonnen
lonnen / fizzbuzz.py
Created January 17, 2023 23:46
my favorite implementation of fizzbuzz
#!/usr/bin/env python3
import itertools
fizzes = itertools.cycle(["", "", "Fizz"])
buzzes = itertools.cycle(["", "", "", "", "Buzz"])
fizzbuzzes = map(lambda x: "".join(x), zip(fizzes, buzzes))
def fizzbuzz(n):
return list(itertools.islice(fizzbuzzes, n))
~/repos/socorro master
[17:39:48] $ tokei .
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Autoconf 2 1536 227 881 428
C Header 12 2195 1259 614 322
C++ 11 7342 6055 470 817
C++ Header 3 1347 1085 80 182
CSS 10 1036 937 55 44
@lonnen
lonnen / serve
Created February 6, 2018 19:15
serve the local directory in python
#!/usr/bin/env python
import sys, os
import SimpleHTTPServer
args = sys.argv[1:]
if len(args) and (args[0] == "-h" or args[0] == "--help"):
print """
Serve a file (or the current directory)
http://benalman.com/
@lonnen
lonnen / search.txt
Last active December 19, 2017 20:57
socorro rules that modify the raw_crash -- raw_crash\[(.*?)\]
# raw_transform ruleset
mozilla_transform_rules
ProductRewrite
ESRVersionRewrite
PluginContentURL
PluginUserComment
processor_app.py
:115 if 'uuid' not in raw_crash:
:116 raw_crash.uuid = uuid
@lonnen
lonnen / heroku-pr-cleanup.sh
Last active February 12, 2016 23:55
heroku pr app cleanup script
# we've been hitting a bug with PR apps under the older permissions system
# which leaves a bunch of dead ones lying around. this will clean them up.
# adjust the grep pattern and organization as necessary
for APP in `heroku apps -o $ORGANIZATION | grep -e -pr-`
do
heroku apps:destroy --app $APP --confirm $APP
done
@lonnen
lonnen / gist:a248a1ef8366d975deda
Created October 21, 2015 16:18
test plugincheck.m.o after migrating datacenters
curl https://plugins.mozilla.org/en-US/plugins_list.json > before.json
# ... migration ...
curl https://plugins.mozilla.org/en-US/plugins_list.json > after.json
diff before.json after.json
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]
);
@lonnen
lonnen / keybase.md
Last active January 2, 2020 22:44
keybase.md

Keybase proof

I hereby claim:

  • I am lonnen on github.
  • I am lonnen (https://keybase.io/lonnen) on keybase.
  • I have a public key ASD6EwG016GSrl1Lo7eTkPdMaQ-Ck6hXv7KOflhUMv2o2Qo

To claim this, I am signing this object:

@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
# Description:
# rerun a leeroy job
#
# Configuration:
# LEEROY_SERVER
#
# Commands:
# hubot rerun <project> <pull-request-#>
# hubot reroy <project> <pull-request-#>
#