Skip to content

Instantly share code, notes, and snippets.

View iohub's full-sized avatar
💭
I may be slow to respond.

iohub

💭
I may be slow to respond.
View GitHub Profile
package main
import (
"bufio"
"container/list"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
deb https://mirrors.ustc.edu.cn/ubuntu/ groovy main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ groovy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ groovy-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ groovy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ groovy-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ groovy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ groovy-backports main restricted universe multiverse
@iohub
iohub / nvme-hdd-fio.sh
Created July 19, 2020 10:10
nvme vs hdd fio benchmark
NVME=$1
HDD=$2
echo 'beginning benchmark: [rand][read]'
sudo fio -filename=$NVME -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k -size=20G -numjobs=64 -runtime=10 -group_reporting -name=nvme.vdi > rand.read.nvme
sudo fio -filename=$HDD -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k -size=20G -numjobs=64 -runtime=10 -group_reporting -name=hdd.vdi > rand.read.hdd
diff rand.read.nvme rand.read.hdd > rand.read.diff
echo 'beginning benchmark: [rand][write]'
from bottle import route, run, template, request
import json, os
@route('/go')
def go():
topn = int(request.query['top'])
reverse = int(request.query['sort'])
jobj = {}
with open('prices.json', 'r') as fobj:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.highcharts-figure, .highcharts-data-table table {
min-width: 360px;
max-width: 800px;
margin: 1em auto;
}
# -*- coding: UTF-8 -*-
import requests, json
from datetime import date
import time
from bs4 import BeautifulSoup
# https://gy.ke.com/ershoufang/xinshijie/a4/
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'}
# -*- coding: UTF-8 -*-
import requests, json
from datetime import date
import time
from bs4 import BeautifulSoup
# https://gy.ke.com/ershoufang/xinshijie/a4/
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.highcharts-figure, .highcharts-data-table table {
min-width: 360px;
max-width: 800px;
margin: 1em auto;
}
# -*- coding: UTF-8 -*-
import requests, json
from datetime import date
import time
from bs4 import BeautifulSoup
# https://gy.ke.com/ershoufang/xinshijie/a4/
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'}
@iohub
iohub / pyface.py
Created February 24, 2020 00:58
detect web page has faces & eyes
import requests
import os
import re
from bs4 import BeautifulSoup as bs4
import cv2
import sys
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')