Skip to content

Instantly share code, notes, and snippets.

use 5.30.0; # or any version above 5.20 really
use experimental 'signatures';
use IO::Async;
use IO::Async::Loop;
use DBI;
use Future::Utils qw(repeat try_repeat);
my $res = assert_database({db_name => "bugs", db_host => "127.0.0.1", db_user => "bugs", db_pass => "bugs"})->get();
print $res;
from contextlib import contextmanager
import subprocess
import re
import sys
import time
import curses
# usage:
# cmd = ['ls', '-l']
# pattern = re.compile('beans')
@dylanwh
dylanwh / ungron.py
Last active May 31, 2022 01:12
ungron but preserve the ordering of object keys
#!/usr/bin/env python3
class gron:
def __init__(self,name="json",val=None):
if isinstance(val, dict):
my_dict = val
else:
my_dict = dict()
if isinstance(val, list):
my_list = val
else:
@dylanwh
dylanwh / blockers.md
Last active July 16, 2021 23:38
Harmony Release Blockers (July 2021)

This is a list of known release blockers for Bugzilla Harmony, in prority list order.

MySQL compatibility & checksetup

We can and should only support current and previous releases of MySQL. People coming from MySQL 5.6 or earlier should be nudged to use utf8mb4, which allows for emojis and some obscure languages.

Currently harmony will work with MariaDB 10+ (any version), but will not function in MySQL 8 due to the word "groups" becoming a reserved word.

@dylanwh
dylanwh / wtf-terminals-and-keys.md
Last active April 30, 2021 21:45
fixing home/end/pageup/pagedown in terminal programs

Problem

Your Home/End/PageUp/PageDown keys are not working consistently in terminal programs like vim or zsh.

Debugging

First, run cat -vt >/dev/null and type Home, followed by enter. You should see something like below

cat -vt >/dev/null
@dylanwh
dylanwh / Bugzilla TODO.md
Last active February 13, 2021 18:26
Dylan's Bugzilla Priorities
  • Migrating from existing schemas should work, including 4.2, 4.4, and 5.0
    • Support schema changes that modify the integer types on mariadb / mysql: this is the cases when we move from an INT to BIGINT, etc.
    • Support mysql 8 with its reserved groups keyword
  • Bugzilla harmony needs to be tested against Postgres (there are a handful of queries that probably need to be revised or abstracted)
  • Make sure bugzilla's dependencies are reasonable and packagable by mainstream distributions: Fedora, Debian, Ubuntu
  • The bugzilla harmony repo should be de-coupled from mozilla-bteam/bmo repo, as creating PRs specifically for it is cumbersome. We will ask github to disassociate the repos for us
--- 5.0 2020-09-06 14:44:12.000000000 -0400
+++ harmony 2020-09-06 14:44:04.000000000 -0400
@@ -1,5 +1,64 @@
json = {};
json.abstract_schema = {};
+json.abstract_schema.antispam_comment_blocklist = {};
+json.abstract_schema.antispam_comment_blocklist.FIELDS = [];
+json.abstract_schema.antispam_comment_blocklist.FIELDS[0] = "id";
+json.abstract_schema.antispam_comment_blocklist.FIELDS[1] = {};
+json.abstract_schema.antispam_comment_blocklist.FIELDS[1].NOTNULL = 1;
--- bugzilla-5.2/Bugzilla/Extension.pm 2020-03-28 15:20:01.000000000 -0400
+++ harmony/Bugzilla/Extension.pm 2020-05-18 09:35:52.000000000 -0400
@@ -13,22 +13,51 @@
use Bugzilla::Constants;
use Bugzilla::Error;
-use Bugzilla::Install::Util qw(
- extension_code_files extension_template_directory
- extension_package_directory extension_web_directory);
+use Bugzilla::Install::Util qw( extension_code_files );
sub signup_email {
my ($c) = @_;
my $v = $c->validation;
try {
Bugzilla::User->new->check_account_creation_enabled;
my $email_regexp = Bugzilla->params->{createemailregexp};
$v->required('email')->like(qr/$email_regexp/);
$v->csrf_protect;