Skip to content

Instantly share code, notes, and snippets.

View crazyboycjr's full-sized avatar
🎯
Focusing

Jingrong Chen crazyboycjr

🎯
Focusing
  • Duke University
  • Durham, NC
  • 12:04 (UTC -04:00)
View GitHub Profile
@crazyboycjr
crazyboycjr / word_list.js
Created September 1, 2019 09:03
扇贝背单词小插件
// usage: open chrome console, paste this and enter
const WORD_PER_PAGE = 10;
const START_PAGE = 1;
const END_PAGE = 10;
const BOOK_ID = 'tvbmg';
// const WORD_LIST_TYPE = 4; // 今日新词
const WORD_LIST_TYPE = 5; // 今日复习
function playItHere(e, link) {
./bootstrap.sh
./b2 tools/bcp
mkdir ../extract
dist/bin/bcp build chrono coroutine context log predef headers tools/boost_install ../extract
./bootstrap.sh --with-libraries=coroutine
./b2 --prefix=./dist --build-type=minimal variant=release link=static debug-symbols=on coroutine install -j 4
g++ b.cc -o b -g -Iextract/dist/include -Lextract/dist/lib/ -lboost_coroutine -lboost_context -lboost_thread
@crazyboycjr
crazyboycjr / show_lldp.sh
Created August 7, 2019 05:10
demonstrate how to execute on mellanox os remotely
#!/bin/bash
read -r -d '' data << EOF
{
"execution_type": "sync",
"commands": [
"show lldp remote",
"show running-config"
]
}
@crazyboycjr
crazyboycjr / spsc_queue.cc
Last active February 11, 2020 15:42
SpscQueue
#include <atomic>
#include <array>
#include <vector>
#include <cassert>
#include <memory>
#include <thread>
#include <chrono>
#include <cstdio>
/*!
@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
@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 / 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 / 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 / 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 / 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>