Skip to content

Instantly share code, notes, and snippets.

View zhaofeng-shu33's full-sized avatar
🎯
Focusing

赵丰 (Zhao Feng) zhaofeng-shu33

🎯
Focusing
  • Institute of Telecommunication and Navigation Satellite
  • Chinese Academy of Space Technology, Beijing, PR China
View GitHub Profile
@zhaofeng-shu33
zhaofeng-shu33 / CppProperties.json
Created August 28, 2019 10:50
Visual Studio Cygwin Configuration
{
"configurations": [
{
"inheritEnvironments": [
"cygwin_64"
],
"name": "x64-Debug",
"includePath": [
"${env.INCLUDE}",
"${workspaceRoot}\\**"
@zhaofeng-shu33
zhaofeng-shu33 / update_code.php
Created September 2, 2019 02:21
git webhook pull code
<?php
function exitJson($err, $msg , $result='')
{
echo json_encode(array('err'=>$err, 'msg'=>$msg , 'result'=>$result));
exit();
}
$postdata = file_get_contents("php://input");
$jsondata = json_decode($postdata);
if($jsondata->ref == 'refs/heads/master'){ // only deploy on master branch
$return_val;
@zhaofeng-shu33
zhaofeng-shu33 / cpu_limit.sh
Last active October 19, 2019 17:30
cpu limit cron job shell script
#!/bin/bash
# get the top 5 processes
result=1490.0
mapfile -t proc_list < <(ps --no-headers --sort=-pcpu -Ao pid,pcpu | head -n 5)
for i in "${proc_list[@]}"; do
process_cpu_list=($i)
process_id=${process_cpu_list[0]}
cpu_usage_percentage=${process_cpu_list[1]}
compare_result=$(awk 'BEGIN{ print '$cpu_usage_percentage'<'$result' }')
if [ ! "$compare_result" -eq 1 ]; then
#!/bin/bash
#Ubuntu 16.04, user root
add-apt-repository ppa:zhaofeng-shu33/gtest
apt update
apt install libgtest-dev
cat <<EOF >> gtest_example.cpp
#include <gtest/gtest.h>
TEST(MATH, ADD){
EXPECT_EQ(1 + 3, 4);
#include <stdio.h>
#include <cuda.h>
#define check( a ) \
{\
if ( (a) != 0 ) {\
printf("ERROR in %s : %d\n", __FILE__ , __LINE__ );\
exit(0);\
}\
}
[feng@bcm triangle_counting_dataset]$ cat slurm-25257.out
3225088881 32212254720 s28.e15.kron.edgelist.bin
[feng@bcm triangle_counting_dataset]$ cksum s29.e10.kron.edgelist.bin
2273941959 42949672960 s29.e10.kron.edgelist.bin
#include <gtest/gtest.h>
class A : public testing::Test {
protected:
int a;
void SetUp() override {
a = 2;
}
};
TEST_F(A, power) {
EXPECT_EQ(a * a, 4);
#include <immintrin.h>
const int NUM = 1000000;
static float X[NUM], Y[NUM], Z[NUM];
void dig_hole() {
__m128 a,b,c;
for(int j = 0; j < 1000; j++) {
for(int i = 0; i < NUM; i += 4) {
a = _mm_load_ps(&X[i]);
b = _mm_load_ps(&Y[i]);
c = _mm_add_ps(a, b);
@zhaofeng-shu33
zhaofeng-shu33 / euclid.py
Created April 18, 2020 10:58
draw euclid norm illustration
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-1, 1, 100)
x_r = np.linspace(1, -1, 100)
f_x = np.concatenate((x, x_r))
powers = [1, 2, 3, 4, 100]
label_str_list = ['$|x|+|y|=1$',
'$x^2+y^2=1$',
'$|x|^3+|y|^3=1$',
'$x^4+y^4=1$',
@zhaofeng-shu33
zhaofeng-shu33 / suggestions_by_feima.md
Last active April 24, 2020 10:17
suggestions_by_feima.md

Targeted at PPT:

  1. whether to write the name of Professor Huang on the first page of PPT
  2. From engineering perspective to introduce the problem?
  3. Introduction of Info-Clustering and Metric Page has a little more interval pages
  4. research works seem not belonging to yourself.
  5. You should draw a figure to illustrate your main contribution.

Splitted Time: 3min Background 5min Related work