Skip to content

Instantly share code, notes, and snippets.

View AkihiroSuda's full-sized avatar

Akihiro Suda AkihiroSuda

View GitHub Profile
@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
@jboner
jboner / latency.txt
Last active November 19, 2024 14:58
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hikoma
hikoma / 3 Concurrent Objects.md
Created August 9, 2012 14:59
3 Concurrent Objects

3 Concurrent Objects (並行オブジェクト)

この章では並行オブジェクトの correctness と progress を規定する様々な方法を学ぶ。

correctness の3つタイプ

  • Quiescent consistency
    • 弱い制約。ハイパフォーマンスを必要とするシステムに使える
  • Sequential consistency
@vishvananda
vishvananda / docker_netns.sh
Last active January 8, 2022 18:21
Expose the netns of a docker container to the host.
#!/usr/bin/env bash
if [ "$1" == "" ]; then
echo "usage: $0 <docker_id>"
echo "Exposes the netns of a docker container to the host"
exit 1
fi
ppid=`docker inspect $1 | grep Pid | awk '{print $2 + 0}'`
if [ "$ppid" == "" ]; then
echo "lxc parent pid not found"
@mainyaa
mainyaa / gce-boot2docker-image-boot.sh
Last active August 17, 2016 04:15
boot instance from boot2docker image on Google Compute Engine (WIP)
#!/usr/bin/env bash
VERSION="0.0.1"
set -e
[ -n "$DEBUG" ] && set -x
usage() {
printf "
Usage: $(basename $0) PROJECT_ID
@Liryna
Liryna / ARMDebianUbuntu.md
Last active October 13, 2024 16:16
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@mapk0y
mapk0y / docker-strage-drivers.mkd
Last active March 14, 2016 05:10
docker strage driver についてのメモ

内容

Docker Storage Drivers を読んでのメモです。

aufs

p31

With O_WRONLY or O_RDWR - write access look it up in the top branch;

@byt3bl33d3r
byt3bl33d3r / nfqueue
Last active February 21, 2020 19:41
Simple packet manipulation with fqrouter's fork of python-netfilterqueue (https://github.com/fqrouter/python-netfilterqueue)
#! /usr/bin/env python2.7
from scapy.all import *
from netfilterqueue import NetfilterQueue
def modify(packet):
pkt = IP(packet.get_payload()) #converts the raw packet to a scapy compatible string
#modify the packet all you want here
@thejh
thejh / seccomp_ptrace_escape.c
Last active September 2, 2024 05:46
PoC for bypassing seccomp if ptrace is allowed (known, documented issue, even mentioned in the manpage)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
@hayajo
hayajo / README.md
Last active March 20, 2019 05:05
Docker単体でコンテナに固定IPを設定する(--privilege)

Docker単体でコンテナに固定IPを設定する

pipeworkweaveを利用せずにコンテナに固定IPを設定するには、docker run--privilegedオプションを指定し、コンテナ内でIPを設定する方法がある。

$ HOST1=$(docker run --privileged -t -d ubuntu /bin/bash)
$ docker exec $HOST1 ip addr add 192.168.0.10/24 dev eth0

$ HOST2=$(docker run --privileged -t -d ubuntu /bin/bash)
$ docker exec $HOST2 ip addr add 192.168.0.11/24 dev eth0