Skip to content

Instantly share code, notes, and snippets.

View K-Wu's full-sized avatar
🆑
κ = α|working> + β|slacking>

Kun Wu K-Wu

🆑
κ = α|working> + β|slacking>
View GitHub Profile
@K-Wu
K-Wu / bing2quizlet.py
Created February 25, 2017 04:17
import to quizlet from bing dictionary
#!/usr/bin/python2.7
# -*- coding: UTF-8 -*-
import sys
if len(sys.argv)!=3:
print "Usage:"
print "python bing2quizlet.py BingDictExport.txt QuizletImport.txt"
exit(1)
print sys.argv
infile=sys.argv[1]
outfile=sys.argv[2]
@K-Wu
K-Wu / autopackage.bat
Created March 3, 2017 12:26
building windows executable from latest commit for python repo
:: This is one script for auto package necessary files distributed to competitors for TeamStyle18 programming contest @EE.THU
:: github-release.exe is built from https://github.com/c4milo/github-release
cd teamstyle18
set GITHUB_TOKEN=[redacted]
git pull origin master
pyinstaller --onefile src/main.py
rename dist\main.exe dist\cpclash.exe
git log --oneline >githashtmp.txt
set /p latestcommit=<githashtmp.txt
set hash=%latestcommit:~0,6%
@K-Wu
K-Wu / cvt_eesast_csv_to_vcf
Last active May 28, 2017 00:03
A script to convert csv file to vcf file, which can be imported to Contact App on mobile phone.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#A script to convert csv file to vcf file, which can be imported to Contact App on mobile phone.
#eesast csv format 姓名,性别,生日,农历生日,班级,宿舍号,手机号,电子邮箱,部门,GitHub用户名,职位
"""
vcf format
BEGIN:VCARD
VERSION:3.0
FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=E5=90=B4=E6=98=86
BDAY;VALUE=text:1900-00-00
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#Wu Kun,2015010625 ee@tsinghua
#This is a multithread implement of dbrt.py
import json
import queue
import time
import urllib.request as req
from bs4 import BeautifulSoup
import threading
@K-Wu
K-Wu / system_report
Created August 3, 2017 08:12
report server running status through sendgrid
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
'''
author: K-Wu
filename: monitor
Python version: 2.7
IDE version: PyCharm
@K-Wu
K-Wu / test_ReLU_mkldnn.cpp
Created August 23, 2018 21:28
Implementing ReLU using MKL-DNN
void relu_impl_ref(float* output,float* data, size_t size) {
#pragma omp parallel for
for (size_t i = 0; i < size; i++)
{
if (data[i] < 0)
{
output[i] = 0;
}
else {
output[i] = data[i];
@K-Wu
K-Wu / invoke_msft_academic_knowledge.py
Created March 13, 2019 04:46
A script that obtains journals and conferences in all sub-fields in computer science by leveraging Microsoft Academic Knowledge API
# Reference 1: https://dev.labs.cognitive.microsoft.com/docs/services/56332331778daf02acc0a50b/operations/565d9001ca73072048922d97
# Reference 2: https://docs.microsoft.com/en-us/azure/cognitive-services/academic-knowledge/paperentityattributes
key1 = 'put_your_key_here'
key2 = 'put_your_key_here'
key = 'put_your_key_here'
CS_CATEGORIES = ["artificial intelligence", "computer hardware", "computer vision", "computer network",
"real-time computing", "distributed computing", "pattern recognition", "data mining",
"machine learning", "embedded system", "knowledge management", "multimedia", "library science",
"simulation", "algorithm", "database", "world wide web", "computer security", "speech recognition",
@K-Wu
K-Wu / MultiBlockFSTest.py
Last active September 21, 2022 22:22
Test script that verifies the read write IO correctness of multiple-block FS implementation
import numpy as np
import os
import math
def do_unmount_mount(mount_dev,mount_point):
os.system("sudo mount {mount_dev} {mount_point}".format(mount_dev=mount_dev, mount_point=mount_point))
os.system("sudo umount {mount_point}".format(mount_point=mount_point))
def do_write_read_test(file_name, file_name2, pos_list_beg, pos_list_end, pos_list2_beg, pos_list2_end, block_char_num, file_content, file_content2, mount_dev, mount_point, remount_prob, is_seek):
if is_seek:
@K-Wu
K-Wu / extract_intel_compiler_options.py
Created April 14, 2019 13:03
Extract Intel Compiler Options and Sort Out to Xlsx
from bs4 import BeautifulSoup
import requests
import xlsxwriter
import bs4
def get_options_url():
BASEURL = "https://software.intel.com"
URL = "https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-alphabetical-list-of-compiler-options"
response = requests.get(URL)
soup = BeautifulSoup(response.content, 'html.parser')
@K-Wu
K-Wu / template.sh
Created October 12, 2021 01:38
Setting and resetting GPU and CPU frequency
#sudo cpupower frequency-set --governor performance
#sudo nvidia-smi --persistence-mode=1
#sudo nvidia-smi --compute-mode=1
#sudo nvidia-smi -lgc 1395,1395
# write benchmark logic here
#sudo cpupower frequency-set --governor powersave
#sudo nvidia-smi -rgc