Skip to content

Instantly share code, notes, and snippets.

@hoosteeno
hoosteeno / gist:11347863
Created April 27, 2014 15:07
keybase.md
### Keybase proof
I hereby claim:
* I am hoosteeno on github.
* I am hoosteeno (https://keybase.io/hoosteeno) on keybase.
* I have a public key whose fingerprint is 7548 B978 E48C 8183 2376 8802 171E 81C2 7A1D 26DC
To claim this, I am signing this object:
@hoosteeno
hoosteeno / unique_ips.bash
Created March 11, 2014 20:29
get unique IPs from apache logs
egrep -i 'wget' 982257_51195_wget.log | awk '{print $1}' | sed -r 's/^.+?gz\:(.+)$/\1/' | uniq -c
@hoosteeno
hoosteeno / modernizr_scraper.bash
Created January 31, 2014 20:57
Figure out which Modernizr tests are required by a custom Modernizr build
egrep -r "Modernizr\." * | egrep -v "(Binary|modernizr\.custom)" | sed -r 's/.+?Modernizr\.(\w+).+?/\1/g'
@hoosteeno
hoosteeno / scrape_bugs.py
Created January 8, 2014 20:27
Create forms for bug lists required by bug 956777
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",
@hoosteeno
hoosteeno / scrape_bugs.py
Created January 6, 2014 22:30
Get all the bug IDs from some Firefox release pages and make a useless URL with them.
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",
@hoosteeno
hoosteeno / web_release_numbering.py
Created November 26, 2013 22:50
Output some version numbers using a schema that might fit web products
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))
@hoosteeno
hoosteeno / get_country_counts.py
Created October 24, 2013 23:11
Get the number of Mozillians in every country.
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'
@hoosteeno
hoosteeno / audit_dotcom.bash
Last active December 25, 2015 07:19
Bash script for outputting a CSV with information about the contents of the mozilla.com SVN tree.
#!/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`
@hoosteeno
hoosteeno / get_dialog_sql.py
Last active December 24, 2015 10:09
Python script for creating sql from healthy dialog spreadsheet.
#!/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';
@hoosteeno
hoosteeno / get_pix.py
Created September 27, 2013 20:32
Get 250 random mozillians avatars (requires python3)
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'