Skip to content

Instantly share code, notes, and snippets.

@nk23x
nk23x / mastodon_well_known.conf
Created September 27, 2023 08:47 — forked from grifferz/mastodon_well_known.conf
Apache config snippet to redirect Mastodon webfinger
RewriteEngine On
RewriteCond %{QUERY_STRING} ^resource=acct:andy@ [NC]
RewriteRule /.well-known/webfinger https://social.bitfolk.com/.well-known/webfinger?resource=acct:grifferz@social.bitfolk.com [NC,L,R=301]
RewriteCond %{QUERY_STRING} ^resource=acct:grifferz@ [NC]
RewriteRule /.well-known/webfinger https://social.bitfolk.com/.well-known/webfinger?resource=acct:grifferz@social.bitfolk.com [NC,L,R=301]
@nk23x
nk23x / gist:f89b852212066cbd6eb96630a2dd4053
Created September 27, 2023 08:47 — forked from dsandler/gist:1f94e95b9ea6cc7d5ec338c41e4b0bcd
sloppy static webfinger for apache
# www/.htaccess
RewriteRule ^[.]well-known/webfinger.*$ /profile/me [L]
# www/profile/.htaccess
Header set Content-Type: application/jrd+json
Header set Access-Control-Allow-Origin: "*"
# www/profile/me
{
"subject": "acct:dsandler@dsandler.org",

Assumptions:

  • WordPress is installed at the root of $host
  • WordPress Webfinger is installed - available at Wordpress.org or Github
location ~ /.well-known/webfinger {
        # add_header 'Access-Control-Allow-Origin' '*';

        if ($arg_resource = "") {
                return 400;
 }
@nk23x
nk23x / gist:e971bda88edcef9cc049ac121ab6feef
Created September 27, 2023 08:44 — forked from aaronpk/gist:5846789
Added WebFinger support to my email address using one rewrite rule and one static file.
[aaron@parecki.com www]$ cat .htaccess
RewriteEngine on
RewriteCond %{QUERY_STRING} resource=acct:(.+)
RewriteRule ^\.well-known/webfinger /profile/%1? [L]
[aaron@parecki.com www]$ cat profile/aaron@parecki.com
{
"subject": "acct:aaron@parecki.com",
"links": [
{
@nk23x
nk23x / remove_global_styles_and_svg_filters.php
Last active April 11, 2023 20:52 — forked from oldrup/remove_global_styles_and_svg_filters.php
Remove Global Styles and SVG Filters from WP 5.9.1 - 2022-02-27
// Remove Global Styles and SVG Filters from WP 5.9.1 - 2022-02-27
function remove_global_styles_and_svg_filters() {
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
}
add_action('init', 'remove_global_styles_and_svg_filters');
// This snippet removes the Global Styles and SVG Filters that are mostly if not only used in Full Site Editing in WordPress 5.9.1+
// Detailed discussion at: https://github.com/WordPress/gutenberg/issues/36834
// WP default filters: https://github.com/WordPress/WordPress/blob/7d139785ea0cc4b1e9aef21a5632351d0d2ae053/wp-includes/default-filters.php
@nk23x
nk23x / RSS.md
Created April 6, 2023 19:34 — forked from thefranke/RSS.md
A list of RSS endpoints, readers and resources

The RSS Endpoint List

Please refer to this blogpost to get an overview.

Replace *-INSTANCE with one of the public instances listed in the scrapers section. Replace CAPITALIZED words with their corresponding identifiers on the website.

Social Media

Twitter

sudo tcpdump -A -s 10240 'tcp port 8080 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | egrep --line-buffered "^........(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: " | sed -r 's/^........(GET |HTTP\/|POST |HEAD )/\n\1/g'
@nk23x
nk23x / add_user.sh
Created January 31, 2023 23:58 — forked from nsabine/add_user.sh
Shell script to add a user to LDAP. Based on OpenLDAP and RFC 2307 memberuid group attributes.
#!/bin/bash
#
# add_user.sh: Add user to LDAP
# Author: Nick Sabine
#
# Defaults
LDAP_BASE="dc=ORG,dc=local"
LDAP_ACCOUNTS_DN="ou=people,${LDAP_BASE}"
LDAP_USER_GROUP="cn=user_group,ou=groups,${LDAP_BASE}"
@nk23x
nk23x / docker-cleanup-resources.md
Created July 28, 2022 08:18 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm