Justin Crawford hoosteeno

View unique_ips.bash
1
egrep -i 'wget' 982257_51195_wget.log | awk '{print $1}' | sed -r 's/^.+?gz\:(.+)$/\1/' | uniq -c
View modernizr_scraper.bash
1
egrep -r "Modernizr\." * | egrep -v "(Binary|modernizr\.custom)" | sed -r 's/.+?Modernizr\.(\w+).+?/\1/g'
View scrape_bugs.py
1 2 3 4 5 6 7 8 9 10
import re
import requests
from bs4 import BeautifulSoup
from mako.template import Template
 
urls = [
"http://www.mozilla.com/en-US/firefox/10.0/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/10.0.1/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/11.0/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/12.0/releasenotes/buglist.html",
View scrape_bugs.py
1 2 3 4 5 6 7 8 9 10
import re
import requests
from bs4 import BeautifulSoup
 
urls = [
"http://www.mozilla.com/en-US/firefox/10.0/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/10.0.1/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/11.0/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/12.0/releasenotes/buglist.html",
"http://www.mozilla.com/en-US/firefox/13.0/releasenotes/buglist.html",
View web_release_numbering.py
1 2 3 4 5 6
year = '2014'
 
for month in range(1, 13):
month = '%02d' % month
for rel in range(1, 7):
print '%s-%s.%s' % (year, str(month), str(rel))
View get_country_counts.py
1 2 3 4 5 6 7 8 9 10
import requests
 
def get_some(offset):
r = requests.get('https://mozillians.org/api/v1/countries/', params = {
'app_name': 'get_your_own',
'app_key': 'get_your_own',
'format': 'json',
'limit': 500,
'offset': offset,
'is_vouched': 'true'
View audit_dotcom.bash
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
# depends on an up-to-date local copy of the mozilla.com svn tree!!
#cd ~/mozilla/mozilla.com; svn update; cd ~/mozilla/legacy
 
echo "LOCATION, SVN, # FILES, BUG, NEXT STEPS"
 
for FILE in `find ~/mozilla/mozilla.com/en-US \
-type d -name .svn -prune -o \
-type f -name *.html -print -o \
-type d -print`
View get_dialog_sql.py
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/python
 
"""
* There is no need to run this per location; you can concatenate all input files or all output files.
* Modify line 15 with input filename
* Direct stdout to output filename (a .sql file)
* Work with DBAs (oncall if necessary) to get this done: https://bugzilla.mozilla.org/show_bug.cgi?id=922340
 
Example output:
UPDATE profile, auth_user SET profile.dialog = '14,7,36' WHERE profile.user_id = auth_user.id AND auth_user.username = 'foo';
View get_pix.py
1 2 3 4 5 6 7 8 9
import re
from random import shuffle
import requests
from PIL import Image
from io import BytesIO
 
app_name = 'get_your_own'
app_key = 'get_your_own'
api_cache = 'pix.out'
View get_mozillians_names.py
1 2 3 4 5 6 7 8 9 10
import requests
 
app_name = 'get_your_own'
app_key = 'get_your_own'
 
next_set = '/api/v1/users/?app_name=' +\
app_name +\
'&format=json&app_key=' +\
app_key +\
'&limit=500&offset=0&is_vouched=true'
Something went wrong with that request. Please try again.