Skip to content

Instantly share code, notes, and snippets.

View muink's full-sized avatar
:octocat:

Anya Lin muink

:octocat:
  • Azeroth land
View GitHub Profile
@muink
muink / parallel.sh
Last active February 15, 2024 16:10
bash parallel execution
#!/bin/bash
pause() { read -p "Press any key to continue..." -n1 -r; }
# func <min> <max>
randnum() {
local min=$1
local max=$[ $2 - $min + 1 ]
local num=$(cat /dev/urandom 2>/dev/null | head -n 8 | cksum | cut -f1 -d' ')
echo $[ $num % $max + $min ]
def urldecode:
def hex2dec:
{"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"A":10,"B":11,"C":12,"D":13,"E":14,"F":15} as $hexTable
| [1,16,256,4096,65536,1048576,16777216,268435456] as $pow16
| def str2dec:
split("") | reverse as $arr
| last( foreach range(length) as $i (0; . + $hexTable[($arr[$i]|ascii_upcase)] * $pow16[$i]) );
if type == "string" then
str2dec
elif type == "array" then
@muink
muink / urid.jq
Last active February 15, 2024 12:52 — forked from jcracknell/urldecode.jq
def urid:
def uni2num:
if 48 <= . and . <= 57 then . - 48 elif 65 <= . and . <= 70 then . - 55 else . - 87 end;
# ^ ^ ^ ^ ^
# | | | | 97 | 102
# uni0 ---------- uni9 -48=0-9 uniA ----------- uniF -55=10-15 unia - unif -87=10-15
# de pct-encoded
def decode:
def loop($i):

Enable & Using vGPU Passthrough

This gist is almost entirely not unlike Derek Seaman's awesome blog:

Proxmox VE 8: Windows 11 vGPU (VT-d) Passthrough with Intel Alder Lake

As such please refer to that for pictures, here i will capture the command lines I used as i sequence the commands a little differently so it makes more logic to me.

This gists assumes you are not running ZFS and are not passing any other PCIE devices (as both of these can require addtional steps - see Derek's blog for more info)

Note:i made no changes to the BIOS defaults on the Intel Nuc 13th Gen. This just worked as-is.

@muink
muink / PCI_HW_passthrough.sh
Last active June 1, 2024 07:27
Proxmox VE install tools
#!/bin/bash
# Constants
DEFGRUB="/etc/default/grub"
KLCMDL="/etc/kernel/cmdline"
MODULES_CONF="/etc/modules"
I915_SRIOV_DIR="$HOME/i915-sriov-dkms"
pause() {
read -s -n1 -p "Press any key to continue ... "
@muink
muink / format_subnet.sh
Last active January 27, 2024 08:25
Network address processing code snippet
# format_subnet <destination variable> <subnet>
# <subnet> format: 192.168.1.1/24
format_subnet() {
[ "$#" -ge 2 ] || return 1
local insubnet="$2"
local address=${insubnet%/*}
local mlen=${insubnet#*/}
local FULL_MASK_INT=$((0xFFFFFFFF))
local MASK_LEN=$mlen
@muink
muink / nginx.conf
Created April 30, 2023 04:08 — forked from unixcharles/nginx.conf
nginx config for http/https proxy to localhost:3000
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
@muink
muink / get_dns_ptr.md
Created April 28, 2023 10:24
Get DNS PTR

DNS PTR Record

Windows: ping -a 192.168.1.1
Windows/Linux: nslookup 192.168.1.1
Windows/Linux: dig -x 192.168.1.1

@muink
muink / enable-china-sms-hkmotw.md
Created March 12, 2023 08:31
开启大陆卡国际短信接收业务

年中运营商统一关闭了国际及港澳台短信接收业务功能,如有国际及港澳台短信接收业务需求,可通过营业厅客户端、客服热线或短信方式办理。 比如中国移动的短信办理方式:发送 KTGJDX 到 10086 即可申请办理。🤨

@muink
muink / extend-harddisk-image.md
Last active December 8, 2023 06:39
Extend hard disk image

Extend hard disk image

depends: coreutils-truncate losetup parted resize2fs lsblk coreutils-df qemu-img

openwrt_img=<openwrt.img>
truncate -s <target size> $openwrt_img
losetup --show -Pf $openwrt_img # ==stdout==> /dev/loop0
parted /dev/loop0 "print"
parted /dev/loop0 "resizepart  -1"