Skip to content

Instantly share code, notes, and snippets.

View fortitudepub's full-sized avatar
💭
Enthusiast of networking and systems, happy hacking

dyz fortitudepub

💭
Enthusiast of networking and systems, happy hacking
View GitHub Profile
package main
import (
"log"
"log/syslog"
"encoding/json"
"fmt"
)
@fortitudepub
fortitudepub / C-states.md
Created June 20, 2018 14:31 — forked from wmealing/C-states.md
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

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
@fortitudepub
fortitudepub / gist:c671bd2d73cba6702d9e8bde617598c9
Created June 11, 2018 14:23
quickly test usb installer using qemu
Step 0
Find the Bus and Device ID:
$ lsusb
...
Bus 001 Device 008: ID 0781:5151 SanDisk Corp. Cruzer Micro Flash Drive
...
Step 1
Boot with QEMU:
@fortitudepub
fortitudepub / notes.md
Created June 3, 2018 03:05 — forked from inecmc/notes.md
How to run multiple Redis instances on Ubuntu 16.04

Create the directory for the new instance

$ sudo install -o redis -g redis -d /var/lib/redis2

Create a new configuration file

$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
@fortitudepub
fortitudepub / latency.txt
Created April 27, 2018 09:44 — forked from jboner/latency.txt
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
1:30:23.895612 IP 100.100.1.2 > 200.200.1.2: ICMP echo request, id 26762, seq 7443, length 64
11:30:23.896175 IP 200.200.1.2 > 100.100.1.2: ICMP echo reply, id 26762, seq 7443, length 64
11:30:23.999616 IP 100.100.1.2 > 200.200.1.2: ICMP echo request, id 26762, seq 7444, length 64
11:30:24.000043 IP 200.200.1.2 > 100.100.1.2: ICMP echo reply, id 26762, seq 7444, length 64
11:30:24.103623 IP 100.100.1.2 > 200.200.1.2: ICMP echo request, id 26762, seq 7445, length 64
11:30:24.104053 IP 200.200.1.2 > 100.100.1.2: ICMP echo reply, id 26762, seq 7445, length 64
11:30:24.207621 IP 100.100.1.2 > 200.200.1.2: ICMP echo request, id 26762, seq 7446, length 64
11:30:24.208094 IP 200.200.1.2 > 100.100.1.2: ICMP echo reply, id 26762, seq 7446, length 64
11:30:24.311626 IP 100.100.1.2 > 200.200.1.2: ICMP echo request, id 26762, seq 7447, length 64
11:30:24.312091 IP 200.200.1.2 > 100.100.1.2: ICMP echo reply, id 26762, seq 7447, length 64
rrdtool create latency_db.rrd \
--step 180 \
DS:pl:GAUGE:540:0:100 \
DS:rtt:GAUGE:540:0:10000000 \
RRA:MAX:0.5:1:500\
#!/bin/bash
#
### set the paths
command="/bin/ping -q -n -c 3"
@fortitudepub
fortitudepub / gist:40e4cc9977329ca01dbdc746f56da6ee
Last active February 24, 2017 07:00
sample quagga and gobgp conf
### quagga
dpdk-pktj# show running-config
Building configuration...
Current configuration:
!
hostname Router
hostname bgpd
log stdout
# use polipo to connect to ss server locally, and support polipo listen under 8123.
git config --global http.proxy http://127.0.0.1:8123
HTTP_PROXY=http://127.0.0.1:8123 go get X
git config --global --unset http.proxy
# Encap this to override the issue because fucking GFW block google sites...