Skip to content

Instantly share code, notes, and snippets.

View LucaFilipozzi's full-sized avatar

Luca Filipozzi LucaFilipozzi

View GitHub Profile
@LucaFilipozzi
LucaFilipozzi / proxy_copy.go
Last active June 18, 2023 11:03 — forked from jbardin/proxy_copy.go
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
os_http_be.map and os_sni_passthrough.map are both just empty files

Keybase proof

I hereby claim:

  • I am LucaFilipozzi on github.
  • I am lucafilipozzi (https://keybase.io/lucafilipozzi) on keybase.
  • I have a public key whose fingerprint is CE98 F258 BB34 4F29 F4F5 AF45 B575 4A69 B6BE 608C

To claim this, I am signing this object:

@LucaFilipozzi
LucaFilipozzi / get_unix_socket_peer_info.py
Last active March 30, 2017 07:59
python implementation of getpeereid() and getpeerpid() for darwin
#!/usr/bin/python
# vim: set ts=4 sw=4 et ai si:
import socket
import struct
def getpeereid(sock):
LOCAL_PEERCRED = 0x001
fmt = struct.Struct('2Ih16I') # see /usr/include/sys/ucred.h struct xucred
res = tuple(fmt.unpack(sock.getsockopt(0, LOCAL_PEERCRED, fmt.size)))

acme4bigip

The purpose of these scripts is to help implement HTTPS Everywhere using acmetool and F5 BigIP LTM.

Usage

Set up acmetool as normal.

DNS

@LucaFilipozzi
LucaFilipozzi / foo.py
Last active September 24, 2017 19:22
exploring python transitions
#!/usr/bin/env python
# exploring all the callbacks
from transitions import Machine, State, Transition
class Matter(Machine):
def __init__(self, *args, **kwargs):
Machine.__init__(
self,
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFLjL34BEADtX6MrSOfKGUNEEIZz6fii28XaUmPtWf4UGxL7g5kRS/KvKYsc
fG4hQB7sxf0+Ogyqc+lsaDy5vUksJSLn187mRjlCpKhj+6TPvh7W3avwOtJ5279V
wKerKkhv+eBEnAW0tBfdVYwrbTS74MSV9DTAs89r2+ROysA2jvela0oeMemuLhpu
Njme4IONmrKJo1RAFPWXHEPDDrtNapPdE1i3rMyQS7/A8Yp0Cr1jOYARM/PnepFS
uiWB5mAXw4wC1K/meQpwJBbio+mxPXjJfzBlxLEOC22Sbf1w3PZ+ZSCzRxqo0kBZ
RoU2pIWmI1Zt3bzHirywuxsZvVeHeYZEEEbrZH+2XFkyZ7GuT+uPWa2c7FIU42ro
XYoHGPAPFzbZ2slZvZy4VHJnAPTWVR8HLFyyr2pJ+K2IoP3WYL9n2u9GDI0gbmB4
Lpmk7HEdMM54m83GhtyJ5b9j9skrgnLe7mfGFAtBotD+WYIfWszetPeaToFfLNLo
@LucaFilipozzi
LucaFilipozzi / gpg-sign-key
Last active August 10, 2023 12:52
gpg-sign-key -- offline key signing utility
#!/bin/bash
# Copyright (C) 2018 Luca Filipozzi
set -e
src="B5754A69B6BE608C"
from='Luca Filipozzi <lfilipoz@emyr.net>'
key="$1"
dir=$(mktemp -d /tmp/gpg-sign-key.XXXXXX)
@LucaFilipozzi
LucaFilipozzi / tc.awk
Last active February 20, 2022 23:11
truecolor and font test
#!/usr/bin/env -S gawk -f
# based on:
# - https://unix.stackexchange.com/a/404415
# - https://gist.github.com/XVilka/8346728
function abs(x) {
return x < 0 ? -x : x;
}
BEGIN {
@LucaFilipozzi
LucaFilipozzi / essential_utilities.md
Last active August 1, 2021 16:47
essential utilities

essential cli utilities: