Skip to content

Instantly share code, notes, and snippets.

View ljjjustin's full-sized avatar

Jiajun Liu ljjjustin

View GitHub Profile
@ljjjustin
ljjjustin / 14_12_1220_syndrome_list.log
Created August 26, 2025 02:03 — forked from lukego/14_12_1220_syndrome_list.log
Mellanox error syndrome lists
BAD_RES_STATE | 0x25B161 | destroy_ctx - context doesn't exist or doesn't match type
BAD_RES_STATE | 0x4A6FC9 | destroy_ctx - context in use
BAD_RES_STATE | 0x60DA55 | destroy_dct - dct not in drained state
BAD_PARAM | 0x67A6F2 | slrg doesnt support write;
BAD_PARAM | 0x0F0E35 | ppamp doesnt support write;
BAD_PKT | 0x4A22F | access reg MAD with specified register id not supported
BAD_PKT | 0x16C592 | mad_ifc: process_smp_lid mkey check failed - silently discarded
INTERNAL_ERR | 0x079233 | set_get_port_info: silently discarded.
BAD_PKT | 0x468496 | mad_ifc: ATTRV_SM_INFO handled by SW
BAD_PKT | 0x071808 | mad_ifc: smp trap repress silently discarded after processing.
#!/bin/bash
# 96 core at most
calc_rps_cpus()
{
local cpu_ids=$(echo $@ | sort)
local h=0
local m=0
local l=0
@ljjjustin
ljjjustin / trace_net_drop.stp
Last active May 30, 2022 15:42
trace_net_drop.stp
https://cloud.tencent.com/developer/article/1631874
@ljjjustin
ljjjustin / README.md
Created May 21, 2022 15:06 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@ljjjustin
ljjjustin / vimrc
Last active December 25, 2022 07:26
use channel to send yanked content
function! s:send2ssh()
if has("nvim")
let ch = sockconnect('tcp', '127.0.0.1:22222')
if ch == 0
echomsg "failed to connect 127.0.0.1:22222"
endif
call chansend(ch, getreg('"'))
call chanclose(ch)
else
let ch = ch_open('127.0.0.1:22222')
@ljjjustin
ljjjustin / README
Last active May 19, 2022 04:42
vim remote copy
# How to setup?
1. local: add sshconfig to your ~/。ssh/config
2. local: copy pbcopy.plist to HOME/Library/LaunchAgents/ and load it with:
launchctl load -w $HOME/Library/LaunchAgents/pbcopy.plist
3. remote: add vimrc to your remote server's vim config file ~/.vimrc
4. remote: copy pbcopy to your remote server and make it excutable
chmod +x /usr/local/bin/pbcopy
5. remote: run vim and yank
6. local: paste the yanked content
@ljjjustin
ljjjustin / mkpasswd.py
Created May 11, 2022 08:14 — forked from lorin/mkpasswd.py
Generate a password hash suitable for /etc/shadow. Warning: Gives incorrect value on OS X.
#!/usr/bin/env python
"""
Generate a password hash, suitable for /etc/shadow
Inspired by this code from OpenStack:
https://github.com/openstack/nova/blob/stable/grizzly/nova/virt/disk/api.py#L549
Usage:
mkpasswd <passwd> [--algo=<hash>]
@ljjjustin
ljjjustin / bible-convert-from-sqlite3-to-zefania.py
Last active December 15, 2020 08:26
convert sqlite3 format bible to zefania format
#!/usr/bin/env python
import os
import re
import sys
import sqlite3
import zhconv
book_name_map = {
#!/bin/bash
if grep -q pypi.pdcts.com.cn /etc/hosts; then
sed -i "/pypi.pdcts.com.cn/ d" /etc/hosts
fi
echo "10.1.1.2 pypi.pdcts.com.cn" >> /etc/hosts
mkdir -p ~/.pip/
touch ~/.pip/pip.conf
@ljjjustin
ljjjustin / README-setup-socket-activated-systemd-service.md
Created December 18, 2019 14:23 — forked from drmalex07/README-setup-socket-activated-systemd-service.md
An example inetd-like socket-activated service. #systemd #inetd #systemd.socket

README

This is an example of a socket-activated per-connection service (which is usually referred to as inetd-like service). A thorough explanation can be found at http://0pointer.de/blog/projects/inetd.html.

Define a socket unit

The key point here is to specify Accept=yes, which will make the socket accept connections (behaving like inetd) and pass only the resulting connection socket to the service handler.