Skip to content

Instantly share code, notes, and snippets.

View splitbrain's full-sized avatar
🙃

Andreas Gohr splitbrain

🙃
View GitHub Profile
@splitbrain
splitbrain / security-scan.sh
Created June 16, 2026 07:18
do a security analysis with claude (using my sbox sandbox)
#!/usr/bin/env bash
#
# security-scan.sh — Static malware/backdoor scan of the current directory.
#
# Runs Claude inside the `sbox` sandbox, non-interactively, to perform a
# READ-ONLY security review of all code in the current working directory.
#
# Nothing in the directory is ever executed. Claude is restricted to read,
# search and write tools (no Bash, no execution), so there is no way for it to
# run, build, or install the code under review — the no-execution rule is
@splitbrain
splitbrain / sbox
Last active June 9, 2026 18:19
bubblewrap setup for claude code
#!/usr/bin/bash
# bubblewrap setup based on https://blog.senko.net/sandboxing-ai-agents-in-linux
# when working on DokuWiki plugins, I want access to dokuwiki above
case "$(basename "$0")" in
sboxdw) bind_dir="$(realpath "$PWD/../../..")" ;;
*) bind_dir="$PWD" ;;
esac
# environment variables to pass through
@splitbrain
splitbrain / block_asn.sh
Last active November 12, 2025 11:46
Block an ASN with UFW
#!/usr/bin/env bash
#
# Block all ranges from a given ASN via UFW.
# Usage:
# sudo ./block_asn.sh AS1234 ["optional comment"]
#
# Requires: ufw, curl
#
set -euo pipefail
<?php
$OTS = '/usr/bin/ots';
loadurl();
if(!isset($_REQUEST['format']) || $_REQUEST['format'] =! 'text'){
header('Content-Type: text/html; charset=utf-8');
html_header();
form();
@splitbrain
splitbrain / openapi.json
Created January 7, 2024 14:32
openapi example DokuWiki
{
"openapi": "3.1.0",
"info": {
"title": "DokuWiki API",
"description": "The DokuWiki API OpenAPI specification",
"version": "12",
"x-locale": "en-US"
},
"servers": [
{
<?php
/**
* Rename all files affected by https://github.com/splitbrain/dokuwiki/issues/3698
*
* Upload this file to your DokuWiki root. It should be placed right next to the doku.php file. Then run
* call it in your browser at https://yourserver.com/yourwiki/turkishfix.php
*
* Delete the file once you're done
*/
if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/');
@splitbrain
splitbrain / sbm.sh
Created September 6, 2012 22:01
CLI tool to create an SSH alias
# SSH bookmark creator
sbm(){
if [ $# -lt 2 ]; then
echo "Usage: sbm <short> [<user>@]<hostname> [-p <port>]" >&2
return 1
fi
short=$1
arg=$2
@splitbrain
splitbrain / azure-ad-b2c-jwt-rsa.php
Created April 15, 2019 12:57
example how to convert Azure AD B2C key info to PEM format
<?php
// composer require phpseclib/phpseclib
require_once('vendor/autoload.php');
$tenant = 'cosmocode';
$policy = 'b2c_1_signupandsignin';
@splitbrain
splitbrain / versionfix.php
Last active March 10, 2017 09:42
Check and fix versions for DokuWiki plugins
#!/usr/bin/php
<?php
echo 'please use https://github.com/splitbrain/dokuwiki-versionfix now';
@splitbrain
splitbrain / action.php
Created May 27, 2016 08:49
log js and non js accesses
<?php
/**
* DokuWiki Plugin jscheck (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();