Skip to content

Instantly share code, notes, and snippets.

@kazhang
kazhang / get_best_acc.py
Created December 10, 2021 23:22
Retrieve the best accuracy from outputs of reference script
#!/usr/bin/env python3
import argparse
import os
from typing import Tuple
def _extract(line:str) -> Tuple[float, float]:
s = line.split(" ")
acc = float(s[3])
acc5 = float(s[5])
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC80DOY6ny7w2RD7Wodbp0XnaDR5Ix6Ym/TugPKB1ygG5En15EA8GdevqenSw5vgOWJbL0OxxCjJmRfkIlo6+nDy0L6I53DW/Roo7YC/eMUaTcfqj2397BM7nIE25WBKJkaJH27p+Hhrstr+D/+yiqc9LOKE7kEUwajcvLb5gD9gjtBc2p2P0vcYMYn26S/e1huGBPWvPb+XxyqrE13PLQHD2PSwfuCBkLMHxy/Xyu/oGTZ6KUiZsQKuH0l4efS2DCWJoRgN+cmzzyZQtk5A1wmd1RYC7C/NMvzJ9rLpscEX8aGt9XXKRaOV0mlYPLJDGl0bSdZdS6V5kfWilzLG/tN kai@kt-nuc
@kazhang
kazhang / ipc.c
Last active October 12, 2016 21:11
#include <unistd.h>
#include <semaphore.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MAX_SIZE 1024
#define FILE_NAME "record.txt"
#define handle_error(msg) \

Keybase proof

I hereby claim:

  • I am kazhang on github.
  • I am kaizh (https://keybase.io/kaizh) on keybase.
  • I have a public key whose fingerprint is 0DCC AC48 1213 4DD7 E48F 2136 FADF 780A 50AA 567C

To claim this, I am signing this object:

@kazhang
kazhang / ceph_bench.sh
Created January 9, 2014 23:33
A Ceph performance benchmark script.
#!/bin/bash
OSD=( ceph-srv4 ceph-srv5 )
VM=( 32 35 37 )
SLEEP=480
if [ "$1" = "-q" ]; then
SILENT=true
else
SILENT=false
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MOD 100003
#define N_GROUP 31
#define MAXLINE 1024
#define MAXLEN 10
static unsigned int
@kazhang
kazhang / fetchRenren.py
Created August 16, 2012 02:58
A simple crawler for Renren.com
#coding:utf-8
import urllib,urllib2,cookielib,re,json
class Renren:
'''This is a simple crawler for renren.com'''
header={'User-Agent':'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.75 Safari/537.1'}
email=''
password=''
def __init__(self,email,passwd,needProxy=False,cookieFile='./cookie.dat'):