Skip to content

Instantly share code, notes, and snippets.

View pandada8's full-sized avatar
🐟
摸鱼

pandada8 pandada8

🐟
摸鱼
View GitHub Profile
@pandada8
pandada8 / snippet.py
Created January 11, 2023 07:21
PymongoInstrumentor with query detail
def request_hook(span: Span, event: monitoring.CommandStartedEvent):
# add detail query info to span
if span.is_recording():
match event.command_name:
case "find":
span.set_attribute("filter", dumps(event.command.get("filter")))
case "update":
updates = event.command.get("updates")
span.set_attribute("filter", dumps(updates.get('q')))
span.set_attribute("update", dumps(updates.get('u')))
@pandada8
pandada8 / etcd
Created August 26, 2022 09:32
etcd on tmpfs
ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS=https://<replace-with-your-own>
ETCD_CERT_FILE=<replace-with-your-own>
ETCD_KEY_FILE=<replace-with-your-own>
ETCD_CA_FILE=<replace-with-your-own>
@pandada8
pandada8 / readme.md
Created August 7, 2022 12:48
Configure Proxmox Node for ZFS over iSCSI

Proxmox provided ZFS over iSCSI for storage. Most tutorials/guides are about using FreeNAS. But you can using an normal proxmox host for ZFS over iSCSI.

On Storage Node:

  1. Install disks, create zpool
  2. Install targetcli via apt install targetcli-fb
  3. Create default tpg via targetcli /iscsi create

On Every Proxmox Node

  1. get client InitiatorNames from /etc/iscsi/initiatorname.iscsi
  2. On Storage Node, run targetcli /iscsi/iqn.2003-01.org.linux-iscsi.pve-2.x8664:sn.71fbbfad3c47/tpg1/acls create
@pandada8
pandada8 / code
Created April 15, 2022 08:54
Launch code from ssh
#!/bin/env python3
from proc.tree import get_process_tree
import os
from pathlib import Path
import sys
import subprocess
ssh_connection = os.getenv('SSH_CONNECTION')
client_ip = ssh_connection.split(" ")[0]
init = get_process_tree()
for i in init.find_all(recursive=True, exe_name="node"):
@pandada8
pandada8 / rx580.txt
Created February 14, 2022 05:18
hashcat --benchmark
C:\Users\pan\scoop\apps\hashcat\6.2.5>hashcat --benchmark
hashcat (v6.2.5) starting in benchmark mode
Benchmarking uses hand-optimized kernel code by default.
You can use it in your cracking session by setting the -O option.
Note: Using optimized kernel code limits the maximum supported password length.
To disable the optimized kernel code in benchmark mode, use the -w option.
hipDeviceGetAttribute(): 1
@pandada8
pandada8 / convert.sh
Created August 23, 2021 16:11
Convert A ZFS root proxmox to btrfs
#!/bin/bash
from=sda
to=sdb
set -ex
apt -y install parted
sgdisk /dev/${from} -R /dev/${to}
sgdisk -G /dev/${to}
mkfs.btrfs -f /dev/${to}3
mkfs.vfat /dev/${to}2
@pandada8
pandada8 / shorten.py
Created February 10, 2021 07:54
reduce torrent filename length
from bcoding import bencode, bdecode
import sys
import time
import os
import pathlib
remapped = {}
rename_list = []
@pandada8
pandada8 / 1.patch
Created May 9, 2020 13:50
patch clash-dashboard without auto location detection
diff --git a/src/lib/request.ts b/src/lib/request.ts
index 9a8b3e8..52fd7b2 100644
--- a/src/lib/request.ts
+++ b/src/lib/request.ts
@@ -110,14 +110,9 @@ export async function getExternalControllerConfig () {
}
export const getInstance = createAsyncSingleton(async () => {
- const {
- hostname,
@pandada8
pandada8 / readme.md
Last active August 26, 2022 10:01
完全使用 Yubikey 进行密码管理

完全使用 Yubikey 进行密码管理

目标:不依赖第三方服务

密码存储和管理

使用 gopass 管理密码,gopass 是 https://www.passwordstore.org/ 的 go 语言实现。密码会被加密之后存储到 git repo 里,多个设备间使用 git 进行同步。

Chrome && Firefox

@pandada8
pandada8 / build.sh
Created April 19, 2019 14:39
Build ubuntu kernel package with your own patch
# checkout repo
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git ubuntu-bionic
# install related stuff
apt build-dep linux-image-$(uname -r)
apt install libncurses5-dev libudev-dev libssl-dev
# patch -p1 < you patch
make oldconfig
make -j $(nproc) deb-pkg LOCALVERSION=-your-suffix