Skip to content

Instantly share code, notes, and snippets.

View johngian's full-sized avatar

John Giannelos johngian

View GitHub Profile
precision recall f1-score support
0 0.99 1.00 0.99 4995
1 0.93 0.73 0.82 243
accuracy 0.98 5238
macro avg 0.96 0.86 0.91 5238
weighted avg 0.98 0.98 0.98 5238
[[4981 14]
precision recall f1-score support
0 0.99 1.00 0.99 4995
1 0.93 0.73 0.82 243
accuracy 0.98 5238
macro avg 0.96 0.86 0.91 5238
weighted avg 0.98 0.98 0.98 5238
precision recall f1-score support
0 0.99 1.00 0.99 4444
1 0.96 0.77 0.85 271
accuracy 0.98 4715
macro avg 0.97 0.88 0.92 4715
weighted avg 0.98 0.98 0.98 4715
[[4435 9]
import time
import dateparser
from scrapy.downloadermiddlewares.retry import RetryMiddleware
from scrapy.http import Request
# Defering requests might cause spider to be idle and close
# Workaround to keep spider open
class ImmortalSpiderMiddleware(object):
# Shortcut for running emacsclient in the background
e() { emacsclient -c "$@" & disown}
import argparse
import json
from bugbug import bugzilla
from datetime import date, timedelta
def get_untriaged(args):
# Calculare daterange
today = date.today()
@johngian
johngian / gist:6a72745d3a79b93a6c35abbcfb121103
Created February 20, 2019 17:01
component_nn_output.txt
(bugbug) nemo@ip-172-31-8-187:~/workspace/bugbug$ python run.py --goal component --classifier nn --train --classify
Using TensorFlow backend.
144 components
Core::Graphics: 3646
Firefox: 3448
Core::Layout: 3248
Core::JavaScript: 2779
Core::DOM: 2715
WebExtensions: 2507
Core::CSS Parsing and Computation: 2167
@@ -110,6 +110,11 @@ class Model():
if self.calculate_classification_metrics:
y_pred = self.clf.predict(X_test)
print(f'No confidence threshold - {len(y_test)} classified')
+
+ # HACK
+ if y_test.ndim == 2:
+ y_test = np.argmax(y_test, axis=1)
+
print(metrics.confusion_matrix(y_test, y_pred, labels=class_names))

SUMO playstore

Estimate how much effort we need to use IAM

What needs to be done

Replace signup/login/logout using custom auth0-sdk with Django and OIDC

Disable RemoteUserMiddleware and RemoteUserBackend
Add django rest framework endpoint for signup/get_profile
Replace auth0.js “class Auth()“ to use local django signup
Replace auth0.js “class Auth()“ to get user profile from rest framework
Adapt frontend for LDAP/Passwordless login/signup
from nameparser import HumanName
def get_access_information(obj):
from mozillians.groups.models import GroupMembership
memberships = GroupMembership.objects.filter(userprofile=obj, status=GroupMembership.MEMBER, group__is_access_group=True)
output = {}
for m in memberships:
output[m.group.url] = None
return output