Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import argparse
import logging
import os
import zipfile
logger = logging.getLogger(__name__)
def main(): # type: () -> None
@gg7
gg7 / fast-forward.js
Created November 27, 2018 16:56 — forked from ChrisFulstowAGL/fast-forward.js
Video playback speed bookmarklet
javascript:var s = prompt("Playback speed?"); document.getElementsByTagName("video")[0].playbackRate = parseFloat(s);
Ranked by discretionary assets managed in hedge funds worldwide, in millions, as of June 30, 2018, unless otherwise noted.
Rank Manager Assets Change from 2017
1 Bridgewater Associates $132,756 7.9%
2 AQR Capital Mgmt. $83,700 9.2%
3 Man Group $59,100 11.3%
4 Renaissance Technologies $57,000 17.3%
5 Two Sigma Inv./Two Sigma Advisers $38,800 9.6%
6 Millennium Mgmt. $35,314 2.7%
7 Elliott Management $35,000 7.0%
@gg7
gg7 / kernel-changes.txt
Created August 1, 2018 09:24
Notable new kernel features for servers since 3.10 (released 30 Jun 2013)
3.11 -- O_TMPFILE open(2) flag, Low latency network polling,
3.12 -- Better Out-Of-Memory handling
3.13 -- nftables, improved NUMA performance, improved page table access scalability in hugepage workloads
3.14 -- SCHED_DEADLINE, KASR, TCP automatic corking
3.15 -- AVX-512 support
3.18 -- overlayfs
4.1 -- MPLS
4.3 -- membarrier(2), limiting the number of PIDs in cgroups
4.4 -- TCP listener handling completely lockless
4.5 -- MADV_FREE for madvise(2), Better epoll multithread scalability
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
empty_regex='\s1500\s+0\s+0\s+0\s+0\s+0\s+0\s+0\s+0\s+0\s+BMU'
o=$(sudo cl-netstat | grep -Pv "$empty_regex")
echo "$o" | grep -P '^(Iface|---)'
@gg7
gg7 / hfsc-shape.sh
Created December 11, 2017 23:15 — forked from eqhmcow/hfsc-shape.sh
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
@gg7
gg7 / ip_vs_sch.c
Created December 8, 2017 19:06 — forked from SaveTheRbtz/ip_vs_sch.c
Consistent source hashing scheduler for IPVS (SH-derivative, GPL)
/*
* IPVS: Source Consistent Hashing scheduling module
*
* Authors: Jonathan Lee <[email protected]>
*
* Changes:
*
*/
#define KMSG_COMPONENT "IPVS"
@gg7
gg7 / iptables-dnat-ssh-tunnel.md
Last active November 9, 2017 17:52
SSH tunnel + iptables DNAT + Docker containers

Tell the kernel to route traffic to 127.0.0.0/8:

root@george:~# sysctl -w net.ipv4.conf.docker0.route_localnet=1

(You might need to do this for additional interfaces -- works for me)

Make sure your INPUT chain of the filter table will accept the connection:

root@george:~# iptables -I INPUT -i docker+ -d 127.0.0.0/8 -j ACCEPT
@gg7
gg7 / cd.md
Last active February 28, 2017 00:43
Continuous delivery with Kubernetes
@gg7
gg7 / docker-veth.sh
Last active October 28, 2016 21:28
Retrive Docker container network veth pair device on host machine
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
# set -o noclobber
# set -o xtrace
cd -- "$(dirname "$0")"