Skip to content

Instantly share code, notes, and snippets.

@indygreg
indygreg / find_old_lines.pl
Created June 17, 2012 20:17
Find oldest lines in git repository
View find_old_lines.pl
#!/usr/bin/perl
# This script parses Git blame's "porcelain" output format and
# ascertains the oldest lines of code seen.
#
# If you want to perform a custom report, just define your own callback
# function and invoke parse_porcelain() with it.
#
# The expected input format is slightly modified from raw `git blame
# -p`. Here is an example script for producing input:
@indygreg
indygreg / Apple Bug Report
Last active November 9, 2022 15:53
Slow readdir() or lstat() behavior for parallel directory walks
View Apple Bug Report
(This is the content of https://bugreport.apple.com/web/?problemID=45648013.)
Area:
Something not on this list
Summary: Calling readdir() from multiple threads apparently acquires a global kernel lock, making directory traversal operations from multiple processes extremely slow as the number of parallel I/O operations increases.
Steps to Reproduce:
@indygreg
indygreg / Dockerfile
Created May 19, 2013 18:37
Dockerfile for Firefox development
View Dockerfile
# 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/.
# Create a build and development environment for Firefox.
FROM ubuntu:12.10
MAINTAINER Gregory Szorc "gps@mozilla.com"
RUN apt-get update
@indygreg
indygreg / import_stdlib.py
Created December 28, 2018 18:00
Python stdlib importing
View import_stdlib.py
import __future__
import _bootlocale
import _collections_abc
import _compat_pickle
import _compression
import _dummy_thread
import _markupbase
import _osx_support
import _py_abc
import _pydecimal
@indygreg
indygreg / pyalloc.rs
Last active December 27, 2018 21:34
Rust allocator for Python
View pyalloc.rs
// 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 https://mozilla.org/MPL/2.0/.
use libc::{c_void, size_t};
use std::alloc;
use std::collections::HashMap;
use std::ptr::null_mut;
const MIN_ALIGN: usize = 16;
View gist:598fd7d8323f35eb970f34d07013e3d2
def reposetup(ui, repo):
class extrarepo(repo.__class__):
def commit(self, self, text="", user=None, date=None, match=None, force=False,
editor=False, extra=None):
extra = extra or {}
# modify extra
return super(extrarepo, self).commit(text=text, user=user, ...)
repo.__class__ = extrarepo
@indygreg
indygreg / kern.bad
Last active August 3, 2016 22:17
kernel parameters
View kern.bad
abi.vsyscall32 = 1
debug.exception-trace = 1
debug.kprobes-optimization = 1
dev.cdrom.autoclose = 1
dev.cdrom.autoeject = 0
dev.cdrom.check_media = 0
dev.cdrom.debug = 0
dev.cdrom.info = CD-ROM information, Id: cdrom.c 3.20 2003/12/17
dev.cdrom.info =
dev.cdrom.info = drive name:
@indygreg
indygreg / pending.py
Created May 19, 2016 19:47
Analyze Automation
View pending.py
import collections
import datetime
import operator
import requests
r = requests.get('http://builddata.pub.build.mozilla.org/builddata/buildjson/builds-pending.js')
pending = r.json()['pending']
by_tree = collections.Counter()
@indygreg
indygreg / gantt.html
Created May 13, 2016 18:42
Draw Gantt Charts of Firefox Automation Scheduling
View gantt.html
<!DOCTYPE html>
<html>
<head>
<title>Automation Job Scheduling</title>
</head>
<body>
<script type="application/javascript;version=1.8">
// Perform a Treeherder API request and obtain the JSON.
function thRequest(path) {
View github-events.py
import gzip
import json
import sys
with gzip.GzipFile(sys.args[1], mode='r') as fh:
line = fh.readline()
if not line:
break
data = json.loads(line)