Skip to content

Instantly share code, notes, and snippets.

View xiongnemo's full-sized avatar
🦘
皆さんの健康を心から祈っています。

Nemo Xiong xiongnemo

🦘
皆さんの健康を心から祈っています。
  • 122.199.30.0/24 || 128.250.0.0/16
  • 03:26 (UTC +10:00)
View GitHub Profile
@xiongnemo
xiongnemo / nginx-autolist.conf
Created January 24, 2024 07:34
Nginx autolist module + json
# docker run -p 65535:80 -v <?>:/nginx -v nginx-autolist.conf:/etc/nginx/conf.d/autolist.conf nginx
autoindex on;
autoindex_format json;
server {
listen 80;
server_name 127.0.0.1;
root /nginx;
@xiongnemo
xiongnemo / chrome_copy_curl_to_py.py
Created July 22, 2023 08:24
Transform "Copy as cURL (bash)" text to request session.
headers = {}
post_flag = False
data_flag = False
data = None
print('Provide your raw "Copy as cURL (bash)" with preceding whitespaces below:\n')
while True:
a = input()
if a.startswith('curl'):
url = a.lstrip('curl').rstrip('\\').strip().strip("'")
continue
@xiongnemo
xiongnemo / brush.sh
Created November 7, 2022 08:19
Boot logo updater script for A12 (MIUI 13) Poco F3/Mi11x/Redmi K40 (codename alioth/aliothin)
# https://forum.xda-developers.com/t/custom-boot-splash-logo-custom-boot-animation-for-poco-f3.4337783/post-86692213
fastboot flash uefisecapp_a uefisecapp.img
fastboot flash uefisecapp_b uefisecapp.img
fastboot flash xbl_a xbl.img
fastboot flash xbl_b xbl.img
fastboot flash xbl_config_a xbl_config.img
fastboot flash xbl_config_b xbl_config.img
fastboot flash logo logo.img
import code
from guppy import hpy
def show_memory_stat():
print("===== GC Count (0th, 1st, 2rd Gen) =====")
print(gc.get_count())
h = hpy()
heap = h.heap()
print("===== Heap =====")
print(heap)
print("===== Heap by Type =====")
#!/bin/sh
# $1: new hostname
hostname $1
echo $1 > /etc/hostname
echo "127.0.1.1 "$1 >> /etc/hosts
hostnamectl set-hostname $1
#/bin/sh
HID_MULTITOUCH_DEVICE_PATH=/sys/bus/hid/drivers/hid-multitouch/
ls HID_MULTITOUCH_DEVICE_PATH | grep ":" | xargs echo > $HID_MULTITOUCH_DEVICE_PATH/unbind
#/bin/sh
# $1: file (/tmp/ubuntu-20.04.3-desktop-amd64.iso)
# $2: device (/dev/sda)
sudo dd bs=4M if=$1 of=$2 conv=fdatasync status=progress
@xiongnemo
xiongnemo / get_cpu_temperature.sh
Created February 20, 2022 08:25
Get cpu temperature for raspi
sudo vcgencmd measure_temp
@xiongnemo
xiongnemo / keybase.md
Created May 4, 2021 15:18
Keybase Identity

Keybase proof

I hereby claim:

  • I am xiongnemo on github.
  • I am xiongnemo (https://keybase.io/xiongnemo) on keybase.
  • I have a public key whose fingerprint is AC20 0ACC BA7D BECC 12F4 B254 5B17 18C8 29F1 AC95

To claim this, I am signing this object:

@xiongnemo
xiongnemo / crop_pic.py
Created April 12, 2021 18:32
Crop pics in list supplied according to left-upmost and right-downmost points
from PIL import Image
with open("list.txt", "r", encoding='utf-8') as input_file_path_list_file:
input_file_path_list = input_file_path_list_file.readlines()
for input_file_path in input_file_path_list:
input_file_path = input_file_path.strip()
if input_file_path.strip() == "":
continue
current_img = Image.open(input_file_path)