This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/* | |
PHP script to fetch Firefox Desktop and Android shipped versions from API | |
and output readable results to your terminal. | |
chmod +x this file and set it as a bash alias: | |
alias v="path/to/firefox_versions.php" | |
The output will look like this: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# usage: backports.py 117 | |
import os | |
import sys | |
version = sys.argv[1] | |
# Create a list of commits not merged directly in the version +1 branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$results = []; | |
foreach (range(1, 100) as $x) { | |
$rule = fn($y) => is_int($x / $y); | |
$results[] = match(true) { | |
$rule(15) => 'fizzbuzz', | |
$rule(3) => 'fizz', | |
$rule(5) => 'buzz', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
function getJson(string $url): array | |
{ | |
$data = file_get_contents($url); | |
return json_decode($data, true, 512, JSON_THROW_ON_ERROR); | |
} | |
$bugs = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Webhook to update a repo for each push on GitHub. */ | |
date_default_timezone_set('Europe/Paris'); | |
$header_match = 'HTTP_X_HUB_SIGNATURE'; | |
$secret_key = 'my_secret_key_in_github_webhook'; | |
$branch = 'master'; | |
function logHookResult($message , $success = false) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias git_show_remote=git_show_remote | |
function git_show_remote() | |
{ | |
for k in `git branch -r | perl -pe 's/^..(.*?)( ->.*)?$/\1/'`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import urllib2 | |
import json | |
from datetime import datetime, timedelta | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getBuilId(string $raw_build_id): array { | |
return [ | |
'year' => substr($raw_build_id, 0, 4), | |
'month' => substr($raw_build_id, 4, 2), | |
'day' => substr($raw_build_id, 6, 2), | |
'hour' => substr($raw_build_id, 8, 2), | |
'minute' => substr($raw_build_id, 10, 2), | |
'second' => substr($raw_build_id, 12, 2), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Proof of concept. | |
PHP script which queries BuildHub for a date (https://buildhub.moz.tools) | |
and returns a json array with the Firefox Nightly build IDs for this day | |
as keys and the mercurial revision they were built from as values. | |
Documention and other scripts on querying buildhub: | |
- https://buildhub2.readthedocs.io/en/latest/user.html#example-is-this-an-official-build-id | |
- https://github.com/mozilla/crash-stop-addon/blob/master/crashstop/buildhub.py#L183 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# This script uses byzanz-record to generate an animated Gif for your interactions | |
# with a window | |
# usage: | |
# Record a window for 3 seconds and save to /home/foo/yo.gif | |
# byzanz-record-window 3 /home/foo/yo.gif | |
# | |
# without parameters, it defaults to 10s and a target file in /tmp/screencast.gif | |
# |
NewerOlder