Skip to content

Instantly share code, notes, and snippets.

View crazyboycjr's full-sized avatar
🎯
Focusing

Jingrong Chen crazyboycjr

🎯
Focusing
  • Duke University
  • Durham, NC
  • 20:10 (UTC -04:00)
View GitHub Profile
@crazyboycjr
crazyboycjr / build-plan.json
Created March 7, 2023 00:49
phoenix example build-plan
{
"invocations": [
{
"package_name": "ansi_term",
"package_version": "0.12.1",
"target_kind": [
"lib"
],
"kind": null,
"compile_mode": "build",
@crazyboycjr
crazyboycjr / PKGBUILD
Last active October 4, 2022 04:53
tinc-latest-PKGBUILD
# Maintainer: hexchain <i at hexchain dot org>
# Maintainer: crazyboycjr <crazyboycjr@gmail.com>
pkgname=tinc-pre
pkgver=latest
pkgrel=1
pkgdesc="VPN (Virtual Private Network) daemon (Pre-release)"
arch=(i686 x86_64 armv7h armv6h)
url="http://www.tinc-vpn.org/"
license=('GPL')
@crazyboycjr
crazyboycjr / display_backtrace.sh
Created August 23, 2022 02:00
Display backtrace
#!/bin/bash
# Usage: scripts/display_backtrace.sh build/rpc-bench /tmp/stderr.log
if [ $# -ne 2 ]; then
echo "Usage: $0 <entry> <backtrace_file>"
exit 0
fi
ENTRY=$1
FILE=$2
addr2line -f -C -p -e $ENTRY `cat $FILE | egrep -o '\+0x[^)]+' | tr '\n' ' '`
@crazyboycjr
crazyboycjr / gist:8f6dd053b5c2d2fbff2806fca72d2aa2
Created June 24, 2022 01:11
Alpa runlog, invalid memory access
(alpa-torch) cjr@ip-172-31-33-99 ~/nfs/alpa-torch-software/alpa (git)-[main] % python3 tests/test_install.py
.compile_pipeshard_executable::trace: 0.97 s
compile_pipeshard_executable::jaxpr operations: 0.00 s
compile_pipeshard_executable::stage construction: 0.00 s
compile_pipeshard_executable::apply grad: 0.00 s
compile_pipeshard_executable::shard stages: 1.69 s
compile_pipeshard_executable::launch meshes: 0.72 s
compile_pipeshard_executable::driver executable: 29.27 s
(MeshHostWorker pid=6134, ip=172.31.39.47) memory_allocated: -0.000 GB max_memory_allocated: -0.000 GB next instruction: Opcode: RUN, Task uuid: 8, Info: allocate zero for recv
(MeshHostWorker pid=6134, ip=172.31.39.47) memory_allocated: -0.000 GB max_memory_allocated: -0.000 GB next instruction: Opcode: RUN, Task uuid: 2, Info: stage 0
@crazyboycjr
crazyboycjr / cmd-notify
Last active June 27, 2021 21:49
Usage: cmd-notify <your_command>
#!/bin/bash
WORKDIR=$(dirname `realpath $0`)
CMD=$*
env ${CMD}
status=$?
if [ $status -eq 0 ]; then
STATUS_PARAM="--success"
@crazyboycjr
crazyboycjr / 71-k380-keyboard.rules
Created May 1, 2020 13:24
running xset in udev.rules
# /etc/udev/rules.d/71-k380-keyboard.rules
ACTION=="add", KERNEL=="hidraw[0-9]*", RUN+="/usr/bin/su cjr -c \"DISPLAY=:1 XAUTHORITY=/home/cjr/.Xauthority xset r rate 200 36\""
ACTION=="add", KERNEL=="hidraw[0-9]*", RUN+="/usr/bin/su cjr -c \"DISPLAY=:1 XAUTHORITY=/home/cjr/.Xauthority setxkbmap -option 'ctrl:nocaps'\""
@crazyboycjr
crazyboycjr / bandwidth_allocation.py
Last active March 27, 2021 03:37
start_flow.py
#!/usr/bin/env python3
import subprocess
import threading
import shlex
import time
import argparse
hosts = [
'192.168.211.2',
'192.168.211.34',
@crazyboycjr
crazyboycjr / GnuPlot Qt terminal Description
Last active February 5, 2020 19:38
GnuPlot Qt terminal hotkeys
While a GnuPlot window is active, you can press certain keys to perform certain actions:
a
Auto-scale to full x and y range (based on x and y values) and replot
b
Toggle between thick border (2 pixels wide) and thin border (1 pixel wide)
g
Toggle grid lines
h
Display help in Davinci
@crazyboycjr
crazyboycjr / btrfs-snapshot.service
Last active January 4, 2020 08:46
btrfs snapshot automation
[Unit]
Description=Btrfs snapshot
[Service]
Type=oneshot
ExecStart=/usr/local/bin/do-btrfs-snapshot.sh
StandardOutput=journal
[Install]
WantedBy=multi-user.target
@crazyboycjr
crazyboycjr / flags.vim
Last active September 11, 2019 13:34
hindent.vim for codefmt
" Copyright 2014 Google Inc. All rights reserved.
" Copyright 2019 Jingrong Chen i@cjr.host
"
" Licensed under the Apache License, Version 2.0 (the "License");
" you may not use this file except in compliance with the License.
" You may obtain a copy of the License at
"
" http://www.apache.org/licenses/LICENSE-2.0
"
" Unless required by applicable law or agreed to in writing, software