Skip to content

Instantly share code, notes, and snippets.

View crazyboycjr's full-sized avatar
🎯
Focusing

Jingrong Chen crazyboycjr

🎯
Focusing
  • Duke University
  • Durham, NC
  • 19:34 (UTC -04:00)
View GitHub Profile
@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 / 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 / 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 / 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 / rc-local.service
Last active January 26, 2023 05:12
rc.local
[Unit]
Description=/etc/rc.local compatibility
[Service]
Type=oneshot
ExecStart=/etc/rc.local
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
@crazyboycjr
crazyboycjr / configuration.txt
Last active August 7, 2019 05:18
Lossless RoCE Configuration for MLNX-OS Switches and Linux Drivers in DSCP-Based PFC and DSCP-Based ECN
Swtich:
switch-mlnxos [standalone: master] (config) # pool ePool0 direction egress-mc size 4194304 type dynamic
switch-mlnxos [standalone: master] (config) # pool ePool1 direction egress size 16777000 type dynamic
switch-mlnxos [standalone: master] (config) # pool iPool0 direction ingress size 4194304 type dynamic
switch-mlnxos [standalone: master] (config) # pool iPool1 direction ingress size 4194304 type dynamic
switch-mlnxos [standalone: master] (config) # interface ethernet 1/10 qos trust L3
switch-mlnxos [standalone: master] (config) # interface ethernet 1/11 qos trust L3
switch-mlnxos [standalone: master] (config) # interface ethernet 1/12 qos trust L3
switch-mlnxos [standalone: master] (config) # interface ethernet 1/10-1/13 ingress-buffer iPort.pg3 bind switch-priority 3
switch-mlnxos [standalone: master] (config) # interface ethernet 1/10-1/13 ingress-buffer iPort.pg6 bind switch-priority 6
@crazyboycjr
crazyboycjr / .zshrc
Created February 9, 2018 07:50
zshrc
# Filename: /etc/skel/.zshrc
# Purpose: config file for zsh (z shell)
# Authors: (c) grml-team (grml.org)
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2 or any later version.
################################################################################
# Nowadays, grml's zsh setup lives in only *one* zshrc file.
# That is the global one: /etc/zsh/zshrc (from grml-etc-core).
# It is best to leave *this* file untouched and do personal changes to
# your zsh setup via ${HOME}/.zshrc.local which is loaded at the end of
@crazyboycjr
crazyboycjr / .vimrc
Last active June 4, 2020 12:27
vimrc
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@crazyboycjr
crazyboycjr / .tmux.conf
Last active April 16, 2021 18:23
tmux.conf
set -g default-terminal "xterm-256color"
set -g mouse on
set -g history-limit 999999999
set -g repeat-time 200
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
run-shell /usr/share/tmux-resurrect/resurrect.tmux
bind a set-window-option synchronize-panes
set -sg escape-time 0
# copy to X clipboard
@crazyboycjr
crazyboycjr / auto.py
Created July 17, 2017 14:04
钉钉自动添加表情脚本
import os
import time
import autopy
from autopy import mouse
basepath = '/home/cjr/Downloads/Telegram Desktop/stickers/shrink22222/'
mouse_path = [(928, 1637), (1197, 1551), (919, 1278), (1408, 1768), (928, 1663)]
def comp(x, y):