Skip to content

Instantly share code, notes, and snippets.

root@p1l2-10g:~# ip rule
0: from all lookup local
32764: from all tos 0x0c lookup E1
32766: from all lookup main
32767: from all lookup default
root@p1l2-10g:~# ip route
10.32.4.0/22 dev br0 proto kernel scope link src 10.32.5.59
10.31.0.0/21 via 10.32.4.1 dev br0 proto bird
#!/bin/bash
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.read_bps_device
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.write_bps_device
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.read_bps_device
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.write_bps_device
# 10MBps
#BPSLIMIT=10485760
@vys
vys / heap.svg
Created November 17, 2012 08:55
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vys
vys / run3.svg
Created November 17, 2012 08:20
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vys
vys / ab-c-1.log
Created November 16, 2012 17:13
simple benchmark to simulate a web request handling in go
~/code/src/mcguirk# ab -t 60 -c 1 -r http://localhost:8081/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
@vys
vys / net-test.go
Created October 2, 2012 18:55
A simple client and server with lots of connections in GO. Testing GO's network connection handling.
package main
import (
"flag"
// "fmt"
"github.com/vys/go-humanize"
"io"
"log"
"net"
//"net/http"
@vys
vys / gist:1519539
Created December 25, 2011 17:44
clang crashes while trying to build latest git
This is the console output on Centos 6.1 where clang/llvm 3.0 was installed from sources. I was trying to build git source from git repo.
[root@v6 git]# make
CC daemon.o
0 clang 0x0000000001a4bc7f
1 clang 0x0000000001a4d9aa
2 libpthread.so.0 0x00007f6a70584490
3 clang 0x0000000001039b64
4 clang 0x0000000001039d9a clang::SourceManager::getLineNumber(clang::FileID, unsigned int, bool*) const + 330
// This solution scored 100/100
int equi ( const vector<int> &A ) {
// write your code here
int size = A.size();
if (size == 0) return -1;
long long *c_left = new long long[size];
c_left[0] = A[0];
for(int i = 1; i < size; i++) {