Skip to content

Instantly share code, notes, and snippets.

@indygreg
indygreg / import_stdlib.py
Created December 28, 2018 18:00
Python stdlib importing
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
// 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;
@indygreg
indygreg / Apple Bug Report
Last active November 9, 2022 15:53
Slow readdir() or lstat() behavior for parallel directory walks
(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:
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
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
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
<!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) {
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)
#!/usr/bin/env python2.7
import collections
import csv
import re
import sys
#import plotly.plotly as py
#from plotly.graph_objs import *
from bokeh.charts import Bar, output_file, show, save
@indygreg
indygreg / gist:c9bd4afada031e72b308
Created June 19, 2015 16:56
git server craziness
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
64 32 0 0 0 4| 51M 3044k|2534k 112M| 908k 6916k| 96k 21k
61 34 0 0 0 5| 50M 17M|3287k 115M|3544k 2596k| 101k 23k
68 28 0 0 0 4| 58M 7752k|2997k 114M|2612k 7692k| 99k 24k
64 32 0 0 0 4| 59M 4584k|3097k 114M| 376k 4584k| 102k 22k
59 37 0 0 0 4| 47M 5388k|3485k 134M| 64k 5232k| 121k 25k
61 34 0 0 0 4| 47M 5836k|2340k 94M|2044k 5836k| 83k 20k
69 28 0 0 0 4| 48M 5816k|2698k 113M|1836k 5816k| 98k 24k
66 30 0 0 0 4| 43M 5644k|3191k 114M| 96k 5452k| 106k 26k