Skip to content

Instantly share code, notes, and snippets.

Avatar

Ted Mielczarek luser

View GitHub Profile
View dynsym_lookup.py
#!/usr/bin/env python
import bisect
import subprocess
import sys
def lookup(lib, find_addr):
funcs = {}
for line in subprocess.check_output(['readelf', '-s', lib]).splitlines():
line = line.strip()
@luser
luser / output.json
Created Mar 12, 2014
Sample stackwalker JSON output
View output.json
{
"crash_info" : {
"address" : "0x0",
"crashing_thread" : 0,
"type" : "SIGSEGV"
},
"crashing_thread" : {
"frames" : [
{
"file" : "hg:hg.mozilla.org/releases/mozilla-aurora:memory/mozalloc/mozalloc_abort.cpp:ea144003b87f",
View configure.py
import argparse
import fnmatch
import os
import string
import subprocess
import sys
from collections import defaultdict
SUBSTS = set(['MOZ_PERMISSIONS', 'MOZ_DMD', 'HAVE_64BIT_BUILD', 'MOZ_CAN_RUN_PROGRAMS', 'MOZ_WIDGET_TOOLKIT', 'MOZ_PNG_ARM_NEON_CHECK', 'MOZ_ALLOW_HEAP_EXECUTE_FLAGS', 'AR_EXTRACT', 'TAR', 'MOZ_SERVICES_COMMON', 'MOZ_VPX_ERROR_CONCEALMENT', 'ZLIB_IN_MOZGLUE', 'MOZ_JPROF', 'MOZ_SOCIAL', 'NONASCII', 'MOZ_MULET', 'VPX_ASFLAGS', 'MOZ_APP_ID', 'MOZ_NO_EV_CERTS', 'MOZ_PNG_CFLAGS', 'MOZ_CHILD_PROCESS_NAME', 'MOZ_OPUS', 'OBJCOPY', 'ASM_SUFFIX', 'MOZ_WEBSPEECH', 'MOZ_FIX_LINK_PATHS', 'GRE_MILESTONE', 'HOST_LDFLAGS', 'VISIBILITY_FLAGS', 'TARGET_MD_ARCH', 'MOZ_ASAN', 'MOZ_APP_UA_NAME', 'GST_API_VERSION', 'MOZ_DEVICES', 'MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS', 'MOZ_SERVICES_HEALTHREPORT', 'MOZ_JPEG_CFLAGS', 'MOZ_B2G_FM', 'MOZ_B2G_RIL', 'MOZ_ANDROID_OMTC', 'MOZ_METRO', 'DSO_LDOPTS', 'MOZ_OPTIMIZE_LDFLAGS', 'MOZ_DISABLE_PARENTAL_CONTROLS', 'OS_LDFLAGS', '_MSC_VER', 'MKSHLIB_FORCE_ALL', 'MOZ_NUWA_PROCESS'
@luser
luser / email_template
Last active Aug 29, 2015
Running group data mangler
View email_template
Hello Mozilla runners!
Mozlandia is nearly upon us, thanks for signing up for a running group! You've been placed in Group %(num)d, which is a distance of %(distance)s and an average pace of %(pace)s. This is all generated from a Python script, so consider it a helpful suggestion more than anything!
Your fellow runners in this group are all included in the To: line of this email. I'm hoping that you will be able to self-organize runs based on this, but if you need assistance feel free to stop into irc.mozilla.org #running or email me directly. You can also use this etherpad I've created: https://etherpad.mozilla.org/portland-running-groups if you want to make your outings available to anyone.
Regards,
-Ted
View get_artwork.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
import urllib, urllib2
import json
import shutil
MOVIES = {
'title_prompt': "Search for a movie title (or type 'tv' to switch to TV Shows): ",
View gist:d65dc5d9bfedfbf30449
wchar_t name[32];
wcsprintf(name, "SaveGeckoProfile%d", pid)
HANDLE event = OpenEvent(EVENT_MODIFY_STATE, FALSE, name);
if (!event) {
printf("Error\n");
return 1;
}
SetEvent(event);
CloseHandle(event);
return 0;
View arrow_test.py
import arrow
from datetime import datetime
from time import time
now = arrow.get(datetime.now(), 'US/Eastern')
print now
print now.timestamp
print now.isoformat()
now = arrow.get(time()).to('US/Eastern')
print now
View luciddream_unittest.py
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
# ***** END LICENSE BLOCK *****
import copy
import os
import re
@luser
luser / test.dat
Created Feb 4, 2015
symbolapi.mozilla.org test data
View test.dat
{"stacks":[[[-1,281341644],[0,4318],[0,4844],[0,5785],[0,9476],[-1,327942816],[-1,339699832],[-1,339699904],[-1,339700576],[-1,339705400],[-1,339758248],[-1,340494936],[-1,340495040],[-1,340497504],[-1,341504016],[-1,342204504],[-1,343731256],[-1,343732928],[-1,343796240],[-1,345867576],[-1,345869184],[-1,347042136],[-1,347047384],[-1,347655480],[-1,347658400],[-1,347658840],[-1,347660560],[-1,347730192],[-1,347732640],[-1,347732888],[-1,347732952],[-1,347847952],[-1,347853176],[-1,348075704],[-1,1436228],[-1,374453552],[-1,374603064],[-1,374818424],[-1,374821200],[-1,1512676],[-1,1545812],[-1,1555220],[-1,1558104],[-1,1559196],[-1,1559316],[-1,1559852],[-1,1561612],[-1,1563804],[-1,414699744],[-1,500335520],[-1,501961328],[-1,506066224],[-1,506068824],[-1,506071128],[-1,506072336],[-1,506073104],[-1,506074640],[-1,506076592],[-1,506324240],[-1,506337840],[-1,506338176],[-1,506338944],[-1,510671008],[-1,510676312],[-1,510676384],[-1,510678144],[-1,510680848],[-1,510686336],[-1,510686920],[-1,510687616],[-1,51
@luser
luser / makegifs.py
Created Feb 12, 2015
moviepy gif loop finder
View makegifs.py
#!/usr/bin/env python
# Taken from http://zulko.github.io/blog/2015/02/01/extracting-perfectly-looping-gifs-from-videos-with-python-and-moviepy/
import os
import sys
import moviepy.editor as mp
from moviepy.video.tools.cuts import FramesMatches
if len(sys.argv) != 2: