Skip to content

Instantly share code, notes, and snippets.

View fgervais's full-sized avatar

Francois Gervais fgervais

  • Montreal, Canada
View GitHub Profile
@fgervais
fgervais / OTBR.sh
Last active February 17, 2022 20:02
Openthread
sudo modprobe ip6table_filter
docker run --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" -p 8080:80 -it --volume /dev/ttyACM0:/dev/ttyACM0 --privileged --entrypoint "" openthread/otbr bash
echo "STARTTIME=5" >> /etc/default/tayga
/app/etc/docker/docker_entrypoint.sh --radio-url spinel+hdlc+uart:///dev/ttyACM0 --nat64-prefix "fd00:64::/96"
@fgervais
fgervais / docker-compose.yml
Created May 14, 2021 18:31
Get udev events from docker container
version: "3.4"
services:
service1:
volumes:
# See newly connected devices
- /dev:/dev
# Get udev events
- /run/udev/control:/run/udev/control
# Allow PF_NETLINK
# https://stackoverflow.com/questions/49687378/how-to-get-hosts-udev-events-from-a-docker-container
# Redirect TLS connection --> Plain text
openssl req -nodes -new -x509 -keyout test-key.pem -out test-cert.pem
docker run --rm --network=host -v $(pwd):/ssl squareup/ghostunnel server --listen 192.168.2.11:8443 --target blynk-cloud.com:80 --key /ssl/test-key.pem --cert /ssl/test-cert.pem --disable-authentication --unsafe-target
# ncat TLS server
# stty to disable buffering, see:
# https://superuser.com/questions/429128/how-can-i-force-netcat-to-send-my-input-immediately-not-just-on-newlines
stty -icanon && ncat --listen 8443 -v --ssl --ssl-cert test-cert.pem --ssl-key test-key.pem
# https://github.com/snail007/goproxy
@fgervais
fgervais / 50-mcp2221.rules
Last active April 10, 2020 03:54
Notes about udev
# https://wiki.archlinux.org/index.php/Talk:Udev
# https://github.com/OpenCBM/OpenCBM/pull/8
# https://wiki.debian.org/USB/GadgetSetup
#
# Must be named to run before "73-seat-late.rules"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00dd", TAG+="uaccess"
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Francois Gervais <francoisgervais@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.6"
requests = "^2.23.0"
@fgervais
fgervais / execute.ps1
Created June 11, 2019 01:17
Powershell execute a function with a timeout
function Install($param1, $param2) {
Start-Sleep -s 2
echo "Installing $param1 $param2"
}
function Execute-With-Timeout($function, $timeout_sec) {
$job = $function &
$start_time = Get-Date
while ($job.State -ne "Completed") {
@fgervais
fgervais / nspawn.sh
Last active April 26, 2019 19:45
Some systemd-nspawn notes
sudo systemd-run --pty --pipe --uid=1000 --property=ProtectHome=read-only /bin/bash
sudo systemd-run --pty --pipe --uid=$(id -u) --property=ReadOnlyPaths=/ --property=ReadWritePaths=$(pwd) $SHELL
sudo systemd-run --pty --pipe --uid=$(id -u) --property=ReadOnlyPaths=/ --property=ReadWritePaths=$(pwd) --property=PrivateTmp=true $SHELL
machinectl shell bionic-1 /bin/bash
@fgervais
fgervais / gpg.sh
Last active July 1, 2023 13:38
Usefull Yubikey commands
gpg --full-generate-key
gpg --edit-key F1CECC69AD0CE297E71217209E551DA1A4C8B21D
gpg --export -a F1CECC69AD0CE297E71217209E551DA1A4C8B21D > F1CECC69AD0CE297E71217209E551DA1A4C8B21D.pub.asc
gpg --export-secret-key --armor F1CECC69AD0CE297E71217209E551DA1A4C8B21D > private-key.asc
# Change expiration date
cd /media/fgervais/e803440f-3cee-40d8-8eca-574318d3ebc6
GNUPGHOME=gnupghome_personal/ gpg --edit-key F121E404CF5235D6415A5098AC9BB2E3257860A2
# key 1, key 2, key 3