Skip to content

Instantly share code, notes, and snippets.

View Gargron's full-sized avatar

Eugen Rochko Gargron

View GitHub Profile

You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Mastodon gGmbH. Except for the license granted herein to Mastodon gGmbH and recipients of software distributed by Mastodon gGmbH, You reserve all right, title, and interest in and to Your Contributions.

  • Definitions:

    "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Mastodon gGmbH. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.

"Contribution" shall mean the code, d

@Gargron
Gargron / nginx.conf
Last active April 21, 2022 12:32
Example nginx configuration for proxying an S3 bucket through Nginx with cache and cache lock
server {
listen 443 ssl;
server_name files.example.com;
root /var/www/html;
keepalive_timeout 30;
location = / {
index index.html;
}
@Gargron
Gargron / mastodon-e2e.md
Last active May 20, 2023 05:13
Mastodon E2EE implementation guide

Mastodon E2EE implementation guide

You need the crypto OAuth scope. Check if there is a way for you to use Olm for your programming language / platform. Using libsignal should be possible but has not been tested.

Step 1: Setting up the device/app

Use Olm to generate the device keypairs and a set of one-time keys. Decide on what the device will be called publicly (this can be changed any time). Also generate a random device ID, this can be a number or a string as long as it's securely random.

There are two device keypairs: The Curve25519 key that we call the identity key, and the Ed25519 key that we call the fingerprint key, which is used for signing and verifying that other keys belong to the same device.

@Gargron
Gargron / example.conf
Last active August 10, 2022 23:10
Using an nginx proxy with cache in front of Wasabi to minimize egress costs
proxy_cache_path /tmp/cache levels=1:2 keys_zone=s3_cache:10m max_size=15g inactive=24h use_temp_path=off;
server {
listen 443 ssl;
server_name files.example.com;
keepalive_timeout 30;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
location = / {
@Gargron
Gargron / code.html
Created February 23, 2018 04:27
Code of Conduct of mastodon.social
<p>The following guidelines are not a legal document, and final interpretation is up to the administration of mastodon.social; they are here to provide you with an insight into our content moderation policies:</p>
<ol>
<li>
The following types of content will be removed from the public timeline:
<ol type="a">
<li>Excessive advertising</li>
<li>Uncurated news bots posting from third-party news sources</li>
<li>Untagged nudity, pornography and sexually explicit content, including artistic depictions</li>
<li>Untagged gore and extremely graphic violence, including artistic depictions</li>
@Gargron
Gargron / Gemfile
Created February 8, 2018 15:22
Mastodon activity stats crawler
source :rubygems
gem 'ruby-progressbar'
gem 'parallelize'
gem 'oj'
gem 'http'
@Gargron
Gargron / map.gdf
Created January 30, 2018 21:28
Map of the fediverse
This file has been truncated, but you can view the full file.
nodedef>name VARCHAR,label VARCHAR
1,social.touha.me
2,gs.jonkman.ca
3,m.bonzoesc.net
4,social.consumium.org
5,occitanie.social
6,redwombat.social
7,community.highlandarrow.com
8,mastodon.daiko.fr
9,mastodon.noraworld.jp
@Gargron
Gargron / account-resolve-test.md
Last active December 19, 2022 05:46
An attempt to resolve an ActivityPub account from counter.social

The fundamental part of ActivityPub federation is the "actor", or in Mastodon terms, the account. Accounts from other servers are queried and saved into the local database to allow sending and receiving interactions. The ResolveRemoteAccountService class is responsible for this, working in two steps: Converting a human-readable handle like username@domain into URLs to the remote account's resources via Webfinger, and then using the linked remote account's JSON representation to create a local mirror.

Step 1: Webfinger

% curl -i "https://counter.social/.well-known/webfinger?resource=th3j35t3r@counter.social"
HTTP/1.1 200 OK
Date: Thu, 04 Jan 2018 03:29:01 GMT
Content-Type: application/jrd+json; charset=utf-8
Transfer-Encoding: chunked
<https://macgirvin.com/channel/mike> <http://purl.org/zot/protocollocations> <https://macgirvin.com/channel/mike> .
<https://macgirvin.com/channel/mike> <http://salmon-protocol.org/ns/magic-envenv> _:c14n4 .
<https://macgirvin.com/channel/mike> <http://salmon-protocol.org/ns/magic-envmagic_keys> _:c14n3 .
<https://macgirvin.com/channel/mike> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/ns/activitystreams#Person> .
<https://macgirvin.com/channel/mike> <http://www.w3.org/ns/ldp#inbox> <https://macgirvin.com/inbox/mike> .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#endpoints> _:c14n0 .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#icon> _:c14n2 .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#name> "Mike Macgirvin" .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#outbox> <https://macgirvin.com/outbox/mike> .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/ac

Keybase proof

I hereby claim:

  • I am gargron on github.
  • I am gargron (https://keybase.io/gargron) on keybase.
  • I have a public key ASCgyQA2BYJllYUj8f0FLZylBC5NS1gGpBq-v56UUATiswo

To claim this, I am signing this object: