Skip to content

Instantly share code, notes, and snippets.

View pansila's full-sized avatar

Lix Zhou pansila

View GitHub Profile
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* mimic skb_queue_head to facilitate the queue-style list manipulation.
*/
struct queue_head {
/* must be first. */
struct list_head list;
u32 qlen;
spinlock_t lock;
@pansila
pansila / ac.py
Last active May 23, 2024 02:14
Calculation the TX OP win chance among different WiFi AC traffics.
import random
from collections import defaultdict
SIFS_2G = 10
SIFS_5G = 16
SLOT = 9
LABELS = ['DIFS', 'BE', 'BK', 'VI', 'VO']
AIFS = [2, 3, 7, 2, 2]
CW_min = [15, 15, 15, 7, 3]
@pansila
pansila / aarch53.cfg
Last active April 17, 2024 02:12
openocd script for debug aarch53
adapter driver jlink
set _CHIPNAME xxxxx
set _DAP_TAPID 0x6BA00477
adapter speed 10000
transport select jtag
bindto 0.0.0.0
reset_config trst_and_srst
telnet_port 4444
gdb_port 2331
# create tap
@pansila
pansila / check_ieee802111_ie.py
Created February 2, 2024 00:47
A scaffold script to check ieee80211 sniffer trace for specified IEs
##!/usr/bin/env python3
import os
import sys
import argparse
import random
from pathlib import Path
from multiprocessing import Pool
import gzip
from scapy.all import *
@pansila
pansila / create-service.sh
Created January 24, 2024 14:38
helper script to create a simple systemd service
#!/usr/bin/env bash
# Check for help flag
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
echo "Create a systemd service file"
echo "Usage: ./create-service.sh -s <service name> -c <command> -w <working directory> -E <run service at startup>"
exit 0
fi
@pansila
pansila / cut.py
Last active December 14, 2023 08:57
cut large file, faster than system's cut by seeking to the target position instead of by chars or lines
#!/usr/bin/env python3
import os, sys
import argparse
try:
from tqdm import tqdm
except ModuleNotFoundError:
def tqdm(it):
return it
@pansila
pansila / main.ahk
Created October 3, 2023 11:23
my autohotkey script
#\::{
SendMessage 0x0112, 0xF140, 0, , "Program Manager"
Sleep 1000
SendMessage 0x0112, 0xF170, 2, , "Program Manager"
}
#+p::run "shutdown.exe /r /fw /t 0" ; reboot to bios
#+r::run "explorer.exe ::{645FF040-5081-101B-9F08-00AA002F954E}" ; Recycle bin
#+s::run "explorer.exe shell:startup"
@pansila
pansila / update_geodb.py
Last active December 29, 2023 12:30
helper to download v2ray daily updated rules
#-*- coding: UTF-8 -*-
import os
import sys
import time
import logging
import socket
import urllib.request
import base64
import hashlib
import tempfile
@pansila
pansila / list_by_size.py
Created April 16, 2022 14:27
List all Git repository objects by size
import subprocess
from tqdm import tqdm
files = []
commitSHA1 = subprocess.check_output(['git', 'rev-list', '--all'], text=True)
for c in tqdm(commitSHA1.splitlines()):
files.extend(subprocess.check_output(['git', 'ls-tree', '-r', '--long', c], text=True).splitlines())
@pansila
pansila / huorong.json
Created February 9, 2022 13:38
一个火绒的防止流氓软件安装的规则
{
"ver":"5.0",
"tag":"hipsuser",
"data":[
{
"id":54,
"power":1,
"name":"禁垃圾软件",
"procname":"*",
"treatment":3,