Skip to content

Instantly share code, notes, and snippets.

View mrcgrtz's full-sized avatar
🐌
I may be slow to respond.

Marc Görtz mrcgrtz

🐌
I may be slow to respond.
View GitHub Profile
@mrcgrtz
mrcgrtz / migrate-bitbucket-to-github.sh
Created March 30, 2026 17:13
Migrate from Bitbucket to GitHub
#!/usr/bin/env bash
set -euo pipefail
# =============================================================================
# migrate-bitbucket-to-github.sh
#
# Batch-migrates all private Bitbucket repositories to GitHub.
# - Repos are created as private on GitHub
# - The default branch is renamed from `master` to `main` (if applicable)
# - Local clones are cleaned up immediately after each push
@mrcgrtz
mrcgrtz / migrate-bitbucket-to-codeberg.sh
Last active March 30, 2026 17:14
Migrate from Bitbucket to Codeberg
#!/usr/bin/env bash
set -euo pipefail
# =============================================================================
# migrate-bitbucket-to-codeberg.sh
#
# Batch-migrates all private Bitbucket repositories to Codeberg.
# - Repos are created as private on Codeberg
# - The default branch is renamed from `master` to `main` (if applicable)
# - Local clones are cleaned up immediately after each push
@mrcgrtz
mrcgrtz / openpgp.md
Created March 25, 2025 16:23
My fingerprint

openpgp4fpr:4B636EE373969FC3A4205FC799D68FF1330EE82B

@mrcgrtz
mrcgrtz / csp-reporter.php
Last active September 3, 2023 21:42
A PHP-based CSP reporter sending mails when a violation occurs.
<?php
declare(strict_types=1);
// Configuration: Set mail from/to.
$from = $_SERVER['SERVER_ADMIN'];
$to = $_SERVER['SERVER_ADMIN'];
// Get the raw POST data.
$data = file_get_contents('php://input');
@mrcgrtz
mrcgrtz / ping-example.html
Last active November 19, 2021 12:07
Simple PHP script for mailing an HTML5 "ping"
<!doctype html>
<meta charset="utf-8">
<title>Ping Test</title>
<p>Click this <a href="https://example.com" ping="/ping.php">test link</a>.
@mrcgrtz
mrcgrtz / greeting.php
Last active June 6, 2021 15:42
User greeting in a random languages, using RUBY-based markup if needed.
<?php
function greeting(string $userName, string $tagName = 'span'): ?string
{
if (!isset($userName)) {
return null;
}
$greetings = [
[
'lang' => 'de',
@mrcgrtz
mrcgrtz / swarm-coin.svg
Last active December 7, 2022 19:27
I recreated the Swarm coin as SVG for my blog.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mrcgrtz
mrcgrtz / WKWebViewExtension.swift
Last active August 11, 2019 14:29
Swift 3 Extension for opening target="_blank" and mailto:/tel: links in native iOS apps
import UIKit
import WebKit
class ViewController: UIViewController {
var webView: WKWebView = WKWebView() {
didSet {
webView.navigationDelegate = self
webView.uiDelegate = self
}
@mrcgrtz
mrcgrtz / html-inspector.js
Last active August 29, 2015 14:05 — forked from hirayama-evolni/min.js
HTML Inspector as a bookmarklet.
(function(w) {
if (typeof w.HTMLInspector !== "undefined") {
w.HTMLInspector.inspect();
} else {
var el = document.createElement('script');
el.setAttribute('src', 'https://rawgit.com/philipwalton/html-inspector/master/html-inspector.js');
el.addEventListener('load', function() {
w.HTMLInspector.inspect();
});
document.head.appendChild(el);
@mrcgrtz
mrcgrtz / template.php
Created October 10, 2012 12:03
Remove unneeded meta tags and links from Drupal 7
<?php
/**
* Override or insert variables into the HTML head.
*
* @param $head_elements
* An array of variables to pass to the HTML head.
*/
function MYTHEME_html_head_alter(&$head_elements) {
// remove unneeded metatags
$remove = array(