Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

杨森 YoungForest

🎯
Focusing
View GitHub Profile
@YoungForest
YoungForest / det.c
Created Dec 10, 2016
求解矩阵对应行列式的值(C语言版)
View det.c
#include <stdio.h>
#include <stdlib.h>
#define MAX 9 /*定义最大为9阶行列式*/
int Fun(int n, int a[MAX][MAX] ); /*函数声明*/
int main()
{
int n = 0; /*初始化阶数n*/
int i = 0, j = 0; /*i,j分别表示行与列*/
int a[MAX][MAX] = {{0}}; /*定义行列式*/
@YoungForest
YoungForest / cpu_benchmark.c
Last active Jan 14, 2017
对CPU进行压力测试的小程序
View cpu_benchmark.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sched.h>
#define PIECE 1
unsigned GetTickCount()
{
struct timeval tv;
@YoungForest
YoungForest / disk_read.py
Last active Jan 14, 2017
硬盘读操作压力测试
View disk_read.py
import time
import sys
def main():
if (len(sys.argv) != 3):
sys.exit("Ususage: %s diskname level.(level can be 0, 1, 2, 3, Bigger level means higer disk read speed.)" %(sys.argv[0]))
disk = sys.argv[1]
# disk = r'/dev/vda'
if sys.argv[2] == '0':
speed = 10
@YoungForest
YoungForest / disk_write.py
Created Jan 14, 2017
硬盘写操作压力测试
View disk_write.py
import time
import sys
import os
def main():
if (len(sys.argv) != 3):
sys.exit("Ususage: %s diskname level.(level can be 0, 1, 2, 3, Bigger level means higher disk read speed.)" %(sys.argv[0]))
disk = sys.argv[1]
# disk = r'/tmp/tmpfile'
disk += '1'
@YoungForest
YoungForest / memory_benchmark.py
Created Jan 14, 2017
内存分配压力测试程序
View memory_benchmark.py
# requirements: sudo apt-get install memtester
import sys
import os
def main():
if len(sys.argv) != 2 and len(sys.argv) !=3:
sys.exit("Usuage: %s <memory> [iterations]" % (sys.argv[0]))
if len(sys.argv) == 3:
iteration = int(sys.argv[2])
View SwitchyRules.ssrl
; Summary: Proxy Switchy! Exported Rule List
; Date: 5/23/2017
; Website: http://bit.ly/proxyswitchy
#BEGIN
[wildcard]
*://*github.com/*
*://*google.com.hk/*
View anniversary.py
import datetime
first_day = datetime.date(2018, 2, 28)
love_day = datetime.date(2018, 3, 19)
day100 = datetime.timedelta(days=100)
print('相识100天: %s' % (first_day + day100))
print('相爱100天: %s' % (love_day + day100))
You can’t perform that action at this time.