Skip to content

Instantly share code, notes, and snippets.

@tomprince
tomprince / default.nix
Created Sep 1, 2021
PEP517 requirements in mach-nix
View default.nix
{mach-nix, pkgs ? import <nixpkgs> {}, lib ? pkgs.lib}:
let
extract-metadata = import ./extract-metadata.nix { inherit lib mkPython pkgs; };
buildPythonApplication = {...}@args: let
metadata = extract-metadata { inherit (args) python src providers; };
requirements = lib.concatStringsSep "\n" metadata.requires_dist;
in
mach-nix.buildPythonApplication ({ inherit requirements; } // args);
in
buildPythonApplication { ... };
View board-layouts.lua
boardLayouts = {
{ -- 1 Board
["Balanced"] = {
{ pos = Vector(5.96, 1.08, 16.59), rot = Vector(0.00, 180.00, 0.00) },
},
["Thematic"] = {
{ pos = Vector(-1.93, 1.08, 20.44), rot = Vector(0.00, 180.00, 0.00), board = " NE" },
},
},
{ -- 2 Board
View file_rev.py
from mercurial import (
registrar,
revset,
)
revsetpredicate = registrar.revsetpredicate()
@revsetpredicate('fromfile()')
def revset_fromfile(repo, subset, x):
View .hgrc
[ui]
username = Tom Prince <tom.prince@hocat.ca>
interface = curses
pagintate = true
statuscopies = true
rollback = false
ignore = ~/.config/hg/ignore
@tomprince
tomprince / changes.diff
Created Nov 16, 2017
Scope changes for Bug 1415619
View changes.diff
> taskcluster-admin@1.0.0 tcadmin /home/tomprince/src/taskcluster/taskcluster-admin
> node lib/index.js "make-gecko-branch-role" "-n" "--all"
scope changes required for role repo:hg.mozilla.org/incubator/stylo:*:
- queue:route:index.docker.images.v1.stylo.*
- index:insert-task:docker.images.v1.stylo.*
+ index:route:index:gecko.cache.level-2.*
+ index:insert-task:gecko.cache.level-2.*
+ secrets:get:project/releng/gecko/build/level-2/*
@tomprince
tomprince / ssh_config
Created Jun 8, 2017
Config for using a bastion
View ssh_config
Host rust-bastion
User tomprince
Hostname 54.215.17.149
Host cargobomb-test
User ec2-user
ProxyJump rust-bastion
Hostname 54.177.234.51
Host cargobomb-prod
View constant.diff
diff --git a/src/twisted/internet/_sslverify.py b/src/twisted/internet/_sslverify.py
index b62ccc5..7535297 100644
--- a/src/twisted/internet/_sslverify.py
+++ b/src/twisted/internet/_sslverify.py
@@ -24,32 +24,27 @@ from twisted.python._oldstyle import _oldStyle
from ._idna import _idnaBytes
+import attr
View gist:cd56378923c60a10244373de4be29c79
def deco(f):
def wrapper(*args, **kwargs):
return ensureDeferred(f(*args, **kwargs))
return wrapper
View spiral.py
from math import sqrt, ceil
def shell(n):
a = int(ceil(sqrt(n)))
if a % 2 == 0:
a += 1
c = a - 1
d = c / 2
return d
View gist:0ebc183042114bd5fe980a1ca6e240a9
import pytest
@pytest.fixture(scope="session", autouse=True)
def cleandir(tmpdir_factory, request):
tmpdir = tmpdir_factory.mktemp('data')
tmpdir.chdir()