Skip to content

Instantly share code, notes, and snippets.

View mildred's full-sized avatar

Mildred Ki'Lya mildred

View GitHub Profile
@mildred
mildred / howto_nat_traversal.md
Last active December 9, 2023 06:59
How To TCP NAT Traversal using Node.js and a STUN Server

How To TCP NAT Traversal using Node.js and a STUN Server

With the scarecity of IPv4 addresses, and IPv6 still not available at large, NAT traversal is becoming a necessity. Especially with the generalisation of Carrier-grade NATs that you can find on mobile connections. Even with IPv6 you may suffer NAT66. Imagine your mobile device that gets only a single Ipv6 address, and you want to share it on your computer.

The solution might be in a decentralized protocol for address attribution such

@mildred
mildred / bootstrap-geard.sh
Last active August 29, 2015 14:04
Install geard from source
#!/bin/sh
#See: https://aur.archlinux.org/packages/ge/geard-git/PKGBUILD
set -e
: ${PREFIX:=/usr/local}
mkdir -p $PREFIX/src/geard.go
cd $PREFIX/src/geard.go
export GOPATH="$PWD"
@mildred
mildred / mail.gear.json
Last active August 29, 2015 14:04
mail.gear.json
{
"Keys":[{
"Type": "authorized_keys",
"Value": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDByLP6c0nvG8itxtyf9ucG6wQG5r6/mwJcPw7aFQb26930zRTOi+PfMjMFBWrhwkFDktlnTBGOvp+bygU4JuipU3pR5BL5o+Lrawd+Uu00kkhxlmkTzP1WYcdpbgBlXutLTuta5Gt4c3e8xUwdcvGHTizKZZZ+BENaOv7j2yfAaJnBJCKcdoI7WCBhuezRWfC2URfVMad/mPxECei/SzGcjhjh1hQiogXH9jwXsrrsU0nuMy8H2LWgqp2nDGFVvqInKC0ICWwDuhpNT21OB0KGdd7LxYdlve/CaMKYRhRMBLmu+grV8akGkmD0uGmF5fVNUOxcRW8PZnCEPiIFvgcv"
}],
"containers":[
{
"name":"mail",
"count":1,
"image":"mildred/exim-dovecot-mail",
@mildred
mildred / README.md
Last active August 29, 2015 14:06
Finding backlinks in a DHT

Nodes that store the content store the links

  • a backlink is a dictionary (that could be represented as JSON to be human-readable) containing a key target with the hash of the object it is about. Other fields are not necessarily fixed. The object size must be small enough (to fit in a UDP packet).
  • to publish a link, the author must regularly send an advertise message to all nodes that store the target. Nodes are supposed to accept or refuse to store the link. But if they refuse to store a link to a specific object, they must also refuse all other links for this object. If the link is malformed (they don't have the object referenced by target), nodes can reject it safely.
  • to query a link about a target, a node must query the owner of the target for links about it. If no links are returned, the node must query other nodes having the target until one node having a link is found. Then the search can then stop.

Notes:

  • when querying links about an object we
@mildred
mildred / subprocess-0.02-1.rockspec
Last active August 29, 2015 14:06
subprocess.rockspec
package = "subprocess"
version = "0.02-1"
source = {
url = "git://github.com/mildred/lua-subprocess.git"
}
description = {
summary = "Subprocess module for Lua",
detailed = [[
]],
homepage = "https://github.com/xlq/lua-subprocess",
@mildred
mildred / server.py
Created October 9, 2014 10:20
Python 3 http.server with PUT support
#!/usr/bin/env python
import argparse
import http.server
import os
class HTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def do_PUT(self):
path = self.translate_path(self.path)
if path.endswith('/'):
@mildred
mildred / download.sh
Created October 20, 2014 10:03
Download from archive.org Wayback Machine
#!/bin/bash
url=http://redefininggod.com
webarchive=https://web.archive.org
wget="wget -e robots=off -nv"
tab="$(printf '\t')"
additional_url=url.list
# Construct listing.txt from url.list
# The list of archived pages, including some wildcard url
@mildred
mildred / README.md
Last active August 29, 2015 14:09
Ports USB déportés avec un RaspberryPi

Installer ArchLinux

Installez ArchLinux sur le Raspberry en utilisant NOOBS, ça marche relativement bien, et ça vous donne une installation ArchLinux minimale. Parfait pour installer des trucs. Une fois installé, vous avez un serveur SSH qui va écouter sur le réseau local. Connectez-vous (le mot de passe est root):

ssh root@alarmpi.local

Pensez a changer votre mot de passe, et ajoutez peut être une authentification par clef SSH:

passwd

@mildred
mildred / README.md
Created November 13, 2014 18:26
systemd user mode

En suivant ce tuto (excepté que je n'ai pas installé shairport, je n'en vois pas l'intérêt), je n'avais pas pulseaudio d'exécuté. Voici les étapes pour activer pulseaudio dans ce cas:

Activer l'utilisateur pi au démarrage:

loginctl enable-linger pi

Se connecter comme simple utilisateur (la variable d'environnement XDG_RUNTIME_DIR doit être modifie pour se connecter au daemon systemd user, sinon ce ne sera pas possible):

su pi

export XDG_RUNTIME_DIR=/run/user/$(id -u)

@mildred
mildred / README.md
Last active January 15, 2016 07:30
How Ansible modules are executed

Modules that require transfer between the local machine and the remote

These are hardcoded server-side. See for example the source code for the fetch module. It is empty with a comment stating it is a virtual module.

Other modules

Call stack: