Skip to content

Instantly share code, notes, and snippets.

bramus /
Last active August 3, 2023 16:56
Mastodon User Page Bookmarklet
jed /
Last active November 19, 2022 20:03
Making your Mastodon account discoverable from your domain, using Cloudflare page rules

Making your Mastodon account discoverable from your own domain, using Cloudflare page rules

Are you (1) moving to Mastodon, but (2) want to use your own Cloudflare-hosted domain for discoverability, and (3) don't want the hassle of managing your own instance?

Well, here's a quick way to make sure that folks can find you when they search Mastodon with your domain. The UX is like this:


(If you're not on Cloudflare or would rather just host a file, use Maarten Balliauw's post, How to discover Mastodon account via custom domain, from which this technique was inspired.)

backerman / profile-snippet-sshargcomplete.ps1
Last active April 30, 2024 08:58
Enable tab completion for ssh hostnames in PowerShell
using namespace System.Management.Automation
Register-ArgumentCompleter -CommandName ssh,scp,sftp -Native -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$knownHosts = Get-Content ${Env:HOMEPATH}\.ssh\known_hosts `
| ForEach-Object { ([string]$_).Split(' ')[0] } `
| ForEach-Object { $_.Split(',') } `
| Sort-Object -Unique
# For now just assume it's a hostname.
RealLukeManning /
Last active December 11, 2022 12:15
A small bash script for sending myself notifications from unRAID
#Checks how much space% is consumed on the array
ARRAY_USED_PERCENT=`df -h /mnt/user | awk '{print $5}' | sed -ne 2p | cut -d'%' -f1`
#Checks how much available space there is in GB
mkg20001 /
Last active May 18, 2024 12:45
A script to generate a config to allow or additionally allow cloudflare addresses for a specific domain
set -e
cf_ips() {
echo "#"
for type in v4 v6; do
echo "# IP$type"
curl -sL "$type/" | sed "s|^|allow |g" | sed "s|\$|;|g"
simonerni / csrf-protection-cloudflare-worker.js
Created July 7, 2018 14:52
Protect any origin from CSRF by checking if the Origin/Referer header match the Host header for "unsafe" methods.
* GET and HEAD requests are by definition idempotent and should be handled by the origin as such. Thus, we can safely pass them on without further origin / referer checks.
const safeMethods = ['GET','HEAD'];
const allowedMethods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'];
addEventListener('fetch', event => {
blackmiaool / sortable-table.vue
Last active October 31, 2022 17:44
sortable el-table
<div ref="wrapper">
<div :key="tableKey">
HoldOffHunger /
Last active May 19, 2024 10:45
Social Share URL's (Summary){url}{app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}{url}&title={title}{url}&text={title}&via={user_id}&hashtags={hash_tags}{url}{phone_number}&text={title}%20{url}{url}&title={title}&caption={text}&tags={hash_tags}{url}{url}&n={title}&t={text}{url}&title={title}
kharakhordindemo / form.php
Created December 22, 2017 15:21
Remove span in Contact Form 7
/*Contact form 7 remove span*/
add_filter('wpcf7_form_elements', function($content) {
$content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
$content = str_replace('<br />', '', $content);
return $content;
messutied / share_to_whatsapp.js
Last active February 19, 2022 22:54
Share to whatsapp bookmarklet
// Following this guide:
const YOUR_PHONE='';`${YOUR_PHONE}&text=${encodeURIComponent(location.href)}`);