Skip to content

Instantly share code, notes, and snippets.

@keturn
keturn / loopback-latency.sh
Created August 20, 2010 22:35
use netem to add latency to loopback network traffic
#!/bin/bash
#
# Add latency to all outgoing traffic on $DEV on tcp/udp $PORT,
# in the amount of $DELAY.
#
# This is matching on both source port and destination port, which
# may hit you twice if you're accessing a local resource.
#
# To see what's currently in effect,
# tc -s qdisc show dev lo
@tochev
tochev / zbase32.py
Created August 9, 2014 10:56
Command line zbase32 encoder and decoder
#!/usr/bin/env python3
"""
Command line zbase32 encoder and decoder.
See http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt
Please note that scrip loads the data in memory.
Copyright: Tocho Tochev <tocho AT tochev DOT net>
Licence: MIT
"""
@rickyzhang-cn
rickyzhang-cn / minivpn.c
Created June 2, 2015 08:36
miniVPN based on OpenSSL and TUN/TAP
/*
* tunproxy.c --- small demo program for tunneling over UDP with tun/tap
*
* Copyright (C) 2003 Philippe Biondi <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active March 14, 2025 01:20
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active March 10, 2025 07:17
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@joepie91
joepie91 / genius-programmer.md
Last active January 26, 2025 18:39
The One Secret Trick To Becoming A Genius Programmer

The One Secret Trick To Becoming A Genius Programmer

Okay, the title of this post is a bit of a lie. There's no one secret trick to becoming a genius programmer - there are two, and they're more habits than tricks. Nevertheless, these kind of 'secret tricks' seem to resonate with people, so I went for this title anyway.

Every once in a while, a somewhat strange thing happens to me. I'll be helping somebody out on IRC - usually a beginner - answering a number of their questions in rapid succession, about a variety of topics. Then after a while, they call me a "genius" for being able to answer everything they're asking; either directly, or while talking about me to somebody else.

Now, I don't really agree with this "genius" characterization, and it can make me feel a bit awkward, but it shows that a lot of developers have a somewhat idealistic and nebulous notion of the "genius programmer" - the programmer that knows everything, who can do everything, who's never stumped by a problem, and of which ther