Skip to content

Instantly share code, notes, and snippets.

View FindHao's full-sized avatar
💭
Don't worry, be happy

Yueming Hao FindHao

💭
Don't worry, be happy
View GitHub Profile
@FindHao
FindHao / filter_time_cmd_results.sh
Created June 14, 2022 22:37
convert linux time cmd's results
def time_convert(tmp_str):
"""
convert linux time cmd's results to seconds.
"""
tmp_str = tmp_str.strip()
result = [ _ for _ in re.split('[ms]', tmp_str) if _.strip()]
if len(result) != 2:
print("error when convert time ", tmp_str)
return None
return float(result[0]) * 60 + float(result[1])
@FindHao
FindHao / selectnsys.py
Last active July 9, 2021 15:02
filter kernel execution time, memory copy traffic, and cudaapi time from nsys report
#!/usr/bin/env python3
import pandas as pd
import os
import re
import argparse
reports_with_path = {}
execute_name = ''
execute_times = 0
@FindHao
FindHao / notify.py
Last active July 8, 2021 15:14
hpc job notify
#!/usr/bin/env python3
import argparse
import subprocess
import time
import requests
START_MODE = 0
FINISH_MODE = 1
FULL_MODE = 2
@FindHao
FindHao / runnsys.sh
Last active April 23, 2021 04:02
nsys script
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Wrong arguments"
exit
fi
working_dir=$1
import re
import argparse
def work(filename, str_pattern):
with open(filename, 'r') as fin:
content = fin.readlines()
if len(content) < 1:
print("wrong report")
exit(1)
@FindHao
FindHao / nvidia-smi.sh
Last active January 18, 2021 15:09
nvidia-smi
echo "" > /tmp/gpu.log
while true;
do
sleep 0.8
filesize=`ll /tmp/gpu.log |cut -d \ -f 5`
maxsize=$((1024*10))
if [ $filesize -gt $maxsize ]
then
tail -n 100 /tmp/gpu.log > /tmp.gpu2.log
mv /tmp/gpu2.log /tmp/gpu.log
@FindHao
FindHao / findhao_rss_sources.xml
Last active October 19, 2019 10:42
我的rss订阅源
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<opml version="1.0">
<head>
<title>
Subscriptions of find from Inoreader [https://www.inoreader.com]
</title>
</head>
<body>
<outline text="Blogs" title="Blogs">
<outline text="cgnail's weblog" title="cgnail's weblog" type="rss" xmlUrl="http://cgnail.github.io/atom.xml" htmlUrl="http://cgnail.github.io/"/>
@FindHao
FindHao / update_hosts.sh
Last active April 10, 2019 10:29
update hosts bash脚本
```
ipv6=$1
work_path="/home/find/Downloads/"
rm $work_path/hosts*
cp /etc/hosts $work_path/._backhosts
if [ "$ipv6" = "4" ]
then
#wget https://coding.net/u/onekeyhosts/p/text/git/raw/master/hosts -O hosts
wget https://coding.net/u/scaffrey/p/hosts/git/raw/master/hosts-files/hosts -O $work_path/hosts
# wget https://raw.githubusercontent.com/sy618/hosts/master/FQ -O hosts
@FindHao
FindHao / cuclean
Created August 31, 2018 02:01
清除无用的gpgusim中间文件
#!/bin/bash
rm -f *fatbin* *cudafe* *.ptx *cubin *reg.c *.ii *module_id *.o _cuobj* _ptxplus* _ptx*
@FindHao
FindHao / ubuntu14.04
Created August 28, 2018 10:39
ubuntu14.04 ustc mirror
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse