Skip to content

Instantly share code, notes, and snippets.

@wugh
wugh / arch_pci_passthrough.md
Last active July 29, 2017 10:33
Archlinux PCI passthrough Tips

总体步骤

大体上按照官网wiki

才坑记录

virt-manager权限问题

把自己加入libvirt这个组就能解决。

安装libvirt的可选依赖

pacman -Si libvirt查看依赖,为了支持nat需要安装ebtables和dnsmasq

@wugh
wugh / simple_roc_curve.py
Created June 13, 2017 10:51
simple version of auc roc calculate
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
simple version of auc roc calculate
'''
import numpy as np
def area(x, y):
@wugh
wugh / predict.cpp
Last active February 15, 2020 05:04
xgboost c++ predictor
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <unordered_map>
#include <cmath>
struct Node {
@wugh
wugh / avazu_ftrl_concurrent.go
Created November 20, 2015 07:52 — forked from ceshine/avazu_ftrl_concurrent.go
Kaggle Avazu Challenge: FTRL-Proximal with L1 & L2 implemented in Go (Concurrent/Multi-threaded)
// Based on tinrtgu's Python script here:
// https://www.kaggle.com/c/avazu-ctr-prediction/forums/t/10927/beat-the-benchmark-with-less-than-1mb-of-memory
package main
import (
"encoding/csv"
"os"
"strconv"
"hash/fnv"
"math"
@wugh
wugh / hash.c
Last active August 29, 2015 14:26 — forked from tonious/hash.c
A quick hashtable implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;
@wugh
wugh / gotour-69.go
Last active August 29, 2015 14:23 — forked from kylelemons/gotour-69.go
package main
import (
"os"
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@wugh
wugh / getip.py
Created May 16, 2015 08:17
根据脚本获取ip地址,并且打印出可用的ipv6地址,需要调用getip.py脚本,该脚本依赖python3
#!/usr/bin/env python3
# encoding: utf-8
import ipaddress
from random import shuffle
#iprange = ipaddress.ip_network('2800:3f0:4000::/36')
iprange = ipaddress.ip_network('2607:f8b0:4005:802::1002/112', strict=False)
<% if(theme.mathjax) {%>
<%- partial('mathjax')%>
<% } %>
@wugh
wugh / fonts.conf
Created November 9, 2013 15:05
fontconfig file
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
Target dots per inch
-->
<match target="pattern">
<edit name="dpi" mode="assign" >
tom@nextzone ~/Projects/pcsclient $ python client.py ~/Downloads/2013国庆环青海湖.zip
Namespace(file='/home/tom/Downloads/2013\xe5\x9b\xbd\xe5\xba\x86\xe7\x8e\xaf\xe9\x9d\x92\xe6\xb5\xb7\xe6\xb9\x96.zip', token='token/access_token.txt')
Traceback (most recent call last):
File "client.py", line 26, in <module>
pcs.upload('/apps/gentoo/' + os.path.basename(args.file), f)
File "/home/tom/.local/lib64/python2.7/site-packages/baidupcs/api.py", line 130, in upload
files=files, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/baidupcs/api.py", line 26, in wrapper
response = func(*args, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/baidupcs/api.py", line 62, in _request