Skip to content

Instantly share code, notes, and snippets.

View djmitche's full-sized avatar

Dustin J. Mitchell djmitche

View GitHub Profile
import time
PHASE = 11 * 24 * 3600 + 7 * 3600 + 45 * 60
now = int(time.time())
next = now - (now % PHASE) + PHASE
print("phase: {} days {} hours {} minutes".format(PHASE / (3600*24), PHASE % (3600*24) / 3600, PHASE % 3600 / 60))
def time_is_link(when):
@djmitche
djmitche / question.md
Last active February 28, 2017 04:02
Rust design question

Context

I'm building a layered application, and I would like to use generic types to be able to test each layer independently of the others. Very generally, (and incorrectly, as lifetimes are omitted) this would look like

trait Layer1 {}
struct RealLayer2<L1: Layer1> {
    layer1: &L1,
}
@djmitche
djmitche / Hv4rirrYRtmcYfD974aCTw mozharness.zip .md
Last active October 3, 2016 17:58
SlX0CIF8QiaNy6oL78cOcA/0/public/build/target.web-platform.tests.zip

failure

https://treeherder.mozilla.org/logviewer.html#?job_id=36914958&repo=mozilla-inbound#L169

 [task 2016-10-03T13:41:40.656339Z] + curl --fail -o mozharness.zip --retry 10 -L https://queue.taskcluster.net/v1/task/Hv4rirrYRtmcYfD974aCTw/artifacts/public/build/mozharness.zip
 [task 2016-10-03T13:41:40.740187Z]   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
 [task 2016-10-03T13:41:40.740271Z]                                  Dload  Upload   Total   Spent    Left  Speed
 [task 2016-10-03T13:41:40.740286Z] 
 [task 2016-10-03T13:41:41.219811Z]   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
 [task 2016-10-03T13:41:41.219892Z] 100    29  100    29    0     0     51      0 --:--:-- --:--:-- --:--:--    60
 [task 2016-10-03T13:41:41.540383Z] 
@djmitche
djmitche / mercurial.md
Last active September 19, 2016 15:32
Mercurial and Mozreview

Mercurial

Conceptual

Not much like the Github / Git-flow model. "Branches" are implemented as repositories, and we have a few types of repositories:

  • try -- pushes here parse "try syntax" which defines the jobs you want to run; used for testing
  • integration -- this is the entry into mozilla-central; patches here are tested but will be backed out by sheriffs if they cause failures (mozilla-inbound and autoland)

Goals

  • Users see a single, consistent "app" representing TaskCluster
  • Users can control access granted to other applications
  • Other applications interact only with the tools site
  • Non-employee authentication remains possible after Persona sunsets
import time
import calendar
import requests
import datetime
import pyinter
URL = 'https://api.pub.build.mozilla.org/treestatus/trees/%s/logs?all=1'
TREES = ['try', 'mozilla-inbound', 'autoland']
DAYS = 7
START = time.time() - 3600*24*DAYS
- hosts: all
connection: local
tasks:
- include: otherfile.yml
vars:
aa: "aa/{{item}}"
with_items:
- A
- B
@djmitche
djmitche / todo.md
Last active May 16, 2016 17:26
Bug 1257945

To Do:

General

  • reorganize per audience / type
  • SSL / static hosting
  • generate with JS
  • Update the "home page" to give newcomers a better direction to go
  • Improve the consistency of where types of information are available, so we're not left saying "that's somewhere on teh docs site" and not being able to find it (which happens to me all the time)
  • Think carefully about audiences and sub-audiences, and providing just the information required (users (gecko, github, gaia), api consumers, developers)

Keybase proof

I hereby claim:

  • I am djmitche on github.
  • I am djmitche (https://keybase.io/djmitche) on keybase.
  • I have a public key ASBbtG7FfJGFzrRhLqZWlYVdPfGB-aDR9ND4rdV6x57UyQo

To claim this, I am signing this object:

@djmitche
djmitche / 00-TODO.md
Last active September 22, 2016 21:36
Dustin's proposal for a new in-tree task-graph generation system