Skip to content

Instantly share code, notes, and snippets.

View g3rv4's full-sized avatar

Gervasio Marchand g3rv4

View GitHub Profile
@g3rv4
g3rv4 / gist:8ba1ef17b4355bb43c6219a9acb7a400
Created August 15, 2023 21:17
Assigning public IPv6 addresses to containers, with a /64 range
Then, I used the actual server range... Hetzner assigns a /64 IPv6 range. We have to tell Docker the network new containers are going to have, and we also have to specify the network ranges new networks will have (docker compose creates them).
If the server has been assigned the `2001:0db8:2a01:4f8::/64` range, that means it can control all the addresses from `2001:0db8:2a01:04f8:0000:0000:0000:0000` to `2001:0db8:2a01:04f8:ffff:ffff:ffff:ffff`. That's... a lot of addresses. The server is using `2001:0db8:2a01:4f8::1` (or `2001:0db8:2a01:04f8:0000:0000:0000:0001`).
Now, each docker network needs at least an /80 range so that it can generate ip addresses from mac addresses.
So what I'm going to do is:
1. Set `2001:0db8:2a01:4f8:1000::/68` as the default network range. It means the default network will have addresses from `2001:0db8:2a01:04f8:1000:0000:0000:0000` to `2001:0db8:2a01:04f8:1fff:ffff:ffff:ffff`
2. Add a default address pool that's `2001:0db8:2a01:4f8:2000::/68`, but so that new networks take /8
@g3rv4
g3rv4 / worker.js
Last active December 5, 2022 18:03
CF worker to ignore requests that are not Follows
addEventListener('fetch', event => {
// NOTE: can’t use fetch here, as we’re not in an async scope yet
event.respondWith(eventHandler(event));
});
async function eventHandler(event) {
const { headers } = event.request;
const contentType = headers.get('content-type') || '';
if (event.request.method === 'POST' && contentType.indexOf('application/activity+json') >= 0) {
@g3rv4
g3rv4 / chars.patch
Created December 4, 2022 22:34
Mastodon increase toot size to 11k chars
index 6a65f44da..6ef45f2f2 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -90,7 +90,7 @@ class ComposeForm extends ImmutablePureComponent {
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
- return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
+ return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 11000 || (isOnlyWhitespace && !anyMedia));
}
@g3rv4
g3rv4 / GistsExporter.ps1
Created November 3, 2020 14:31
Script to download all the gists for a user
param(
[Parameter(Mandatory = $true)]
[string]$PathToApi,
[Parameter(Mandatory = $true)]
[string]$PAT,
[Parameter(Mandatory = $true)]
[string]$Username,
// ==UserScript==
// @name Hide SO Sidebar
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://stackoverflow.com/*
// @match https://*.stackoverflow.com/*
// @match https://*.stackexchange.com/*
// @grant GM_addStyle
@g3rv4
g3rv4 / docker-compose.yml
Last active May 12, 2017 18:52
How to set up the retweeter using docker-compose. In order for it to work, you need to tweak the environment variables (except `CELERY_BROKER`) and the `/local/path/to/db`
version: '2'
services:
somenameyoulike:
image: 'g3rv4/retweeter'
hostname: somenameyoulike
restart: always
environment:
- TW_APP_KEY=
- TW_APP_SECRET=
- TW_OAUTH_TOKEN=

Keybase proof

I hereby claim:

  • I am g3rv4 on github.
  • I am g3rv4 (https://keybase.io/g3rv4) on keybase.
  • I have a public key whose fingerprint is 1498 4268 C76C E3A1 0833 937E 914A E73B FDED 3604

To claim this, I am signing this object: