Skip to content

Instantly share code, notes, and snippets.

View ta1hia's full-sized avatar
🌴
just chillen

tahia ta1hia

🌴
just chillen
View GitHub Profile
@ta1hia
ta1hia / README.md
Created June 22, 2020 19:04
mochitest instructions

Cross-origin mochitests

Cross-origin (or "xorigin") mode allows for mochitests to be run in a cross origin iframe. Used in conjunction with fission mode, xorigin mode can be used validate site isolation in Firefox.

When cross-origin mode is enabled, the toplevel window runs at "http://mochi.xorigin-test:8888" and individual mochitests are loaded in a cross origin iframe running at "http://mochi.test:8888".

Enabling cross-origin mode

Xorigin mode can be enabled by a flag or environment variable:

./mach mochitest --enable-xorigin-tests [path to test]

@ta1hia
ta1hia / testinfo_report_inline_comment.diff
Created June 4, 2020 13:51
Remove comment stripping and add comment field in "test-info report" mach cmd
diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py
--- a/testing/mozbase/manifestparser/manifestparser/ini.py
+++ b/testing/mozbase/manifestparser/manifestparser/ini.py
@@ -26,7 +26,8 @@ class IniParseError(Exception):
def read_ini(fp, defaults=None, default='DEFAULT', comments=None,
- separators=None, strict=True, handle_defaults=True):
+ separators=None, strict=True, handle_defaults=True,
+ show_inline_comments=False):
@ta1hia
ta1hia / check-logs.py
Created June 1, 2020 13:23
check-push v2 with updated treeherder apis
#!/usr/bin/env python
# vim:se sts=4 sw=4 et fenc=utf-8 ft=python:
import json
import re
import sys
def generate_all_logs_from_files():
logs = []
for fn in sys.argv[1:]:
with open(fn) as f:
@ta1hia
ta1hia / groups.py
Created May 4, 2020 20:43
generate annotated spreadsheet
import re
not_xorigin_re = re.compile(r'(?<!!)xorigin')
debug_re = re.compile(r'xorigin && \(?debug')
opt_re = re.compile(r'xorigin && !debug')
comment_re = re.compile(r'xorigin[^\n#]#\s*([^\n]*)')
def match(condition, debug):
if not condition:
return False
@ta1hia
ta1hia / gist:16b5fdd66b1544bd335f84a46af4bb63
Created September 5, 2017 18:11 — forked from bsmartt13/gist:efa02c40ea12c09d9c3a
OTX IP Reputation download links (updated hourly)
https://reputation.alienvault.com/reputation.generic.gz
https://reputation.alienvault.com/reputation.generic
https://reputation.alienvault.com/reputation.data
https://reputation.alienvault.com/reputation.snort.gz
https://reputation.alienvault.com/reputation.snort
https://reputation.alienvault.com/reputation.iptables.gz
https://reputation.alienvault.com/reputation.iptables
https://reputation.alienvault.com/reputation.squid.gz
https://reputation.alienvault.com/reputation.squid
https://reputation.alienvault.com/reputation.unix.gz
@ta1hia
ta1hia / redbluebluered.py
Created July 10, 2016 23:01
dropbox example q
def rebluebluered(s, pattern):
return search(s, pattern, dict())
def search(left, pattern, matches):
if (not pattern and left) or (pattern and not left):
return False
if not pattern and not left:
return True
@ta1hia
ta1hia / backtrack_permutations.py
Created June 28, 2016 16:23
skiena's backtracking
def backtrack(A, k, N):
""" General backtrack algorithm which enumerates all possible solutions """
if is_a_solution(A, k, N):
process_solution(A, k, N)
return
k = k + 1
candidates = construct_candidates(A, k, N)
for c in candidates:
@ta1hia
ta1hia / priority_queue.py
Last active June 25, 2016 00:05
minheap
class PQ:
"""
Priority queue implemented as a heap (minheap).
"""
def __init__(self ):
self.heap = [0]
self.size = 0
def insert(self, x):
def qsort(A, L, U):
if L < U:
T = A[L]
M = L #pivot
for i in range(L+1, U):
if A[i] < T:
M += 1
tmp = A[M]
A[M] = A[i]
A[i] = tmp
@ta1hia
ta1hia / djikstra.py
Created May 28, 2016 17:07
simple djikstra
import heapq
def djikstra(graph, s, z):
dist = {s:0}
pred = {s:None}
visited = {}
q = []
heapq.heappush(q, s)
while q: