Skip to content

Instantly share code, notes, and snippets.

View xingfanxia's full-sized avatar
🎯
Focusing

AX xingfanxia

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am xingfanxia on github.
  • I am axcomputelabs (https://keybase.io/axcomputelabs) on keybase.
  • I have a public key ASAMJdxIYKiMSXyKiZzWaEokPW3nCutFzohG05w5C-u-0go

To claim this, I am signing this object:

@xingfanxia
xingfanxia / delete_git_submodule.md
Created March 23, 2024 10:20 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@xingfanxia
xingfanxia / pal-scripts.md
Created January 23, 2024 09:47 — forked from Bluefissure/pal-scripts.md
Some Useful PalWorld Scripts

Pal World Scripts (Linux & Bash)

Remember to replace the folder directory, <AdminPassword>, <RCONPort> to your own.

Also, you need to use crontab to schedule the following scripts if necessary.

Supervisor

I'm using supervisor to restart the service, the example config is as:

@xingfanxia
xingfanxia / organize.zshrc
Created January 18, 2024 14:45
Video Organization
organize_videos() {
# Use the 'rename' command to remove text between '@' and the last '.'
rename 's/@(.*?)\././' *-*
# Use the 'rename' command to remove all text from the last '-' before the file extension
rename 's/-(?!.*-).*?(\.[^.]+)$/$1/' *-*
# Iterate over files with specific extensions and organize them into folders
for f in *.mp4 *.mkv; do
# Skip if not a file
@xingfanxia
xingfanxia / hashable_cache.py
Created February 4, 2022 12:10 — forked from adah1972/hashable_cache.py
Decorator for using dicts/lists with any Python cache function (like lru_cache)
# Inspired by https://gist.github.com/harel/9ced5ed51b97a084dec71b9595565a71
from collections import namedtuple
import functools
import json
import six
Serialized = namedtuple('Serialized', 'json')
@xingfanxia
xingfanxia / exec.bash
Created June 30, 2020 06:27
unpack pdf into zips
parallel 'mkdir -p {.} && convert -density 144 {} {.}/{.}.jpg && cd {.} &&
convert *.jpg \
-background white \
-bordercolor white \
-border 0x50 \
-append \
-shave 0x50 \
-resize 1080 \
-quality 85 \
-sharpen 0x1.0 \
@xingfanxia
xingfanxia / pdf2im.sh
Created June 30, 2020 01:51 — forked from theonegis/pdf2im.sh
PDF文件转为长图片
#!/bin/bash
## 计算pdf文件名,参考资料:
# http://www.runoob.com/linux/linux-shell-variable.html
# https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash/965072
# https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash
# https://stackoverflow.com/questions/3362920/get-just-the-filename-from-a-path-in-a-bash-script
# 需要安装GhostScript和ImageMagick
pdfname=$1
@xingfanxia
xingfanxia / bc6.py
Created October 17, 2019 23:38
Hack this site
def decrypt(s):
return "".join([chr(ord(s[i])-i) for i in range(len(s))])
@xingfanxia
xingfanxia / a.sh
Last active July 25, 2019 21:59
Show large file in git history
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' -f HEAD
@xingfanxia
xingfanxia / keybase.md
Created July 20, 2018 03:36
keybase.md

Keybase proof

I hereby claim:

  • I am xingfanxia on github.
  • I am xingfanxia (https://keybase.io/xingfanxia) on keybase.
  • I have a public key ASB6UVXHbv5iOW8lpuXZm1mTm4plWSDcQFbvEYHfeNKQHwo

To claim this, I am signing this object: