Skip to content

Instantly share code, notes, and snippets.

View crazyboycjr's full-sized avatar
🎯
Focusing

Jingrong Chen crazyboycjr

🎯
Focusing
  • Duke University
  • Durham, NC
  • 15:46 (UTC -04:00)
View GitHub Profile
@crazyboycjr
crazyboycjr / list-counters.sh
Last active September 10, 2019 19:24
list-mlnx-counters.sh
#!/bin/bash
intf="rdma0"
if [ $# -gt 0 ]
then
intf=$1
fi
ibdev=`ibdev2netdev | grep $intf | awk '{print $1}'`
@crazyboycjr
crazyboycjr / list-alive.sh
Created March 11, 2018 13:30
list-alive.sh
#!/bin/bash
port=$1
if [ -z $port ]; then port=22; fi
echo 'scan port:' $port
for i in {1..254}; do echo 10.2.96.$i; done | xargs -P 300 -I {} sh -c "nc {} $port -z -w 1 && echo {} || true"
@crazyboycjr
crazyboycjr / PFC_headroom_formula.md
Created March 12, 2018 06:20
PFC_headroom_formula.md

PFC headroom formula

According to the 3th page of the reference material, the following elements need to be taken into consideration

  • Maximum transmission unit (MTU) on the transimitting end of receiver R
  • Speed of Wire W
  • Transceiver latency (negligible) < 1280bytes
  • Response time of sender S
  • MTU on the transmitting end of sender S

The headroom should be the possible total length of bits transmitted in these five stages above.

@crazyboycjr
crazyboycjr / Makefile
Last active January 4, 2020 08:40
A Makefile for LaTex
PACKAGE = main
PDF = ${PACKAGE}.pdf
all: ${PDF}
%.pdf: %.tex
xelatex $<
- bibtex $*
xelatex $<
@crazyboycjr
crazyboycjr / my_rdma_get_devices.cc
Last active August 25, 2022 14:29
my_rdma_get_devices for debug ibv_get_device_list not consistent with rdma_get_devices problem
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <glob.h>
#include <limits.h>
#include <netdb.h>
#include <poll.h>
#include <pthread.h>
#include <semaphore.h>
#include <stddef.h>
@crazyboycjr
crazyboycjr / netdev_to_ibdev.cc
Last active July 25, 2018 07:14
netdev_to_ibdev
#include "prism/logging.h"
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <string>
#include <iostream>
#include <fstream>
#include <unordered_map>
@crazyboycjr
crazyboycjr / mvapich2-2.3.patch
Last active September 10, 2019 19:23
mvapich2-2.3.patch
diff -Naur mvapich2-2.3/src/include/mpi.h.in mvapich2-2.3_new/src/include/mpi.h.in
--- mvapich2-2.3/src/include/mpi.h.in 2018-07-24 22:30:00.000000000 +0800
+++ mvapich2-2.3_new/src/include/mpi.h.in 2019-09-07 21:44:17.173515626 +0800
@@ -1138,6 +1138,9 @@
int MPI_Initialized(int *flag);
int MPI_Abort(MPI_Comm comm, int errorcode);
+extern void* g_mpi_comm_world;
+inline void* MPI_Comm_world_comm() { return g_mpi_comm_world; }
+
@crazyboycjr
crazyboycjr / c_cpp_properties.json
Last active July 2, 2020 11:01
vscode user settings and c_cpp_properties.json for LKD
{
"env": {
"kernel_release": "5.5.2-arch1-1"
},
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/lib/modules/${env:kernel_release}/build/include",
@crazyboycjr
crazyboycjr / wpa_supplicant.conf
Created January 3, 2019 06:36
wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="iFudan.1x"
scan_ssid=1
key_mgmt=WPA-EAP
identity="your_stuid"
password="your_passwd"
eap=PEAP
@crazyboycjr
crazyboycjr / motd.sh
Created January 20, 2019 07:17
motd for MSN group
#!/bin/sh
echo -n 'MSN' | toilet -f mono12 -F border --metal > /etc/motd && fortune | cowsay -f tux >> /etc/motd
echo 'Have a lot of fun...' >> /etc/motd