Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View caugner's full-sized avatar
💭
I may be slow to respond.

Claas Augner caugner

💭
I may be slow to respond.
  • Mozilla
  • Paris, France
  • 16:47 (UTC +02:00)
  • X @ClaasAug
View GitHub Profile
@caugner
caugner / gh-rerun-failed-runs.sh
Created February 6, 2024 12:59
Rerun failed workflow runs for current commit
#!/usr/bin/env sh
gh run list -c `git rev-parse HEAD` --status=failure --json 'databaseId' | jq -r '.[] | .databaseId' | xargs -n1 gh run rerun --failed
@caugner
caugner / gh-rerun-failed-workflow.sh
Last active February 6, 2024 12:58
Rerun failed workflow
#!/usr/bin/env sh
gh run list --workflow 'auto-merge' --status=failure --json 'databaseId' | jq -r '.[] | .databaseId' | xargs -n1 gh run rerun --failed
@caugner
caugner / github-prs-with-size.js
Created October 31, 2023 17:00
Last 1000 mdn/content PRs with size metrics as CSV
import { writeFileSync } from "node:fs";
import { octokit } from "./lib.js";
async function pullRequests(login, repo, limit, { columns }) {
const items = [];
let after = null;
let hasNextPage = false;
do {
@caugner
caugner / record_variable_types.ts
Created October 18, 2023 16:13
Record types of variables (e.g. for untyped function parameters)
function recordVariableTypes(name: string, variables: Record<string, any>) {
const types = Object.entries(variables).reduce(
(obj, [key, value]) => ({ ...obj, [key]: typeOf(value) }),
{}
);
recordTypes(name, types);
}
function recordTypes(name: string, types: Record<string, string>) {
const path = `types_${name}.json`;
@caugner
caugner / find-unlisted-issues.php
Last active September 11, 2020 18:35
Psalm: Find unlisted issues
<?php
// Usage:
// 1. Clone: https://github.com/vimeo/psalm.git
// 2. Run this script inside the repository.
$dir = __DIR__ . '/docs/running_psalm/';
$issues = glob($dir . 'issues/*.md');
$docs = file_get_contents($dir . 'error_levels.md');
foreach ($issues as $issue) {
@caugner
caugner / deep.php
Created April 25, 2019 17:09
deepl-translate-multiple-texts
<?php
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Exception\GuzzleException;
require_once 'vendor/autoload.php';
$input = ["Hallo", "Welt"];
@caugner
caugner / font-awesome-4to5.php
Created April 11, 2019 12:49
Font Awesome 4to5
<?php
if ($argc !== 2) {
echo "USAGE: $argv[0] PATH";
exit(1);
}
$root = $argv[1];
if (!is_dir($root)) {
@caugner
caugner / mb_detect_encoding_ascii.php
Created March 18, 2019 13:52
php: mb_detect_encoding returns false for chr(128..193) and chr(245..255)
<?php
for ($i = 0; $i <= 255; $i++) {
printf("%d:%s\n", $i, mb_detect_encoding(chr($i)));
}
/**
Output:
0:'ASCII'
1:'UTF-8'
@caugner
caugner / docker-phpmyadmin-local-server.sh
Last active January 6, 2019 22:45
phpmyadmin with local server (docker)
#!/usr/bin/env sh
docker pull phpmyadmin/phpmyadmin
docker stop myadmin || true
docker rm myadmin || true
docker run --name myadmin -d --network="host" -e PMA_HOST=127.0.0.1 phpmyadmin/phpmyadmin
@caugner
caugner / yarn-run-lint.log
Created July 13, 2018 16:43
yarn run lint 2>&1 | grep -v -P "(OK|json$)" | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" > yarn-run-lint.log
yarn run v1.5.1
$ node test/lint
Found 1 inconsistent feature(s) in api/AnimationEffectTimingReadOnly.json:
→ 9 × AnimationEffectTimingReadOnly [api.AnimationEffectTimingReadOnly]:
→ No support in webview_android, but this is not declared for sub-feature(s): delay, direction, duration, easing, endDelay, fill, iterationStart, iterations
→ No support in chrome, but this is not declared for sub-feature(s): delay, direction, duration, easing, endDelay, fill, iterationStart, iterations
→ No support in chrome_android, but this is not declared for sub-feature(s): delay, direction, duration, easing, endDelay, fill, iterationStart, iterations
→ No support in edge, but this is not declared for sub-feature(s): delay, direction, duration, easing, endDelay, fill, iterationStart, iterations
→ No support in edge_mobile, but this is not declared for sub-feature(s): delay, direction, duration, easing, endDelay, fill, iterationStart, iterations
→ No support in firefox, but this is not declared for