Skip to content

Instantly share code, notes, and snippets.

View wiccy46's full-sized avatar

Jiajun wiccy46

  • Holoplot
  • Berlin
View GitHub Profile
@wiccy46
wiccy46 / python_path.py
Created May 27, 2021 12:51
[python_path] Path magics for python #python
# Add ./.. of the file to python path
sys.path.insert(0, os.path.normpath(os.path.join(os.path.realpath(__file__), '..', '..')))
# Current path
base = os.path.dirname(os.path.realpath(__file__))
# File abs path
cos.path.realpath(__file__)
@wiccy46
wiccy46 / terminal.md
Last active February 6, 2024 17:36
[terminal] Terminal Cheatsheet #terminal

Windows list all files recursively

dir /a-D /S /B your_dir(orLeaveEmpty)

Unix list all files recursively

find your_dir -print -ls

Monitor process verbose

journalctl -fu process_name -fu follows the stdout.

@wiccy46
wiccy46 / regex.md
Created October 13, 2020 07:51
[regex]Regex cheatsheet #regex

abc... Letters 123... Digits

@wiccy46
wiccy46 / pythonsys.py
Created August 14, 2020 08:36
[pythonsys]System relative snippets #python
# add one level above to path.
sys.path.insert(0, os.path.normpath(os.path.join(os.path.realpath(__file__),
'..', '..')))
# -------------------------------------
import shutil, os
shutil.rmtree(path, ignore_errors=True) # rm folder
os.makedirs(path, exist_ok=True) # mkdir
@wiccy46
wiccy46 / gitcheat.md
Last active September 24, 2020 19:10
[GITCheat]Git Cheat Sheet #git

Add an existing project

  1. Create a new repository on GitHub. You can also add a gitignore file, a readme and a licence if you want
  2. git init
  3. git add .
  4. git commit -m "initial commit"
  5. git remote add origin remote_repository_URL
  6. git remote -v
  7. git push -f origin master
@wiccy46
wiccy46 / pandoc.sh
Created May 17, 2020 21:32
[pandoc]Pandoc basics #pacdoc#markdown#html#latex
pandoc --pdf-engine=xelatex --toc -N -o dest.pdf target.md
@wiccy46
wiccy46 / tmux.txt
Created May 14, 2020 20:48
[tmux] tmux collection #tmux
# Activate config
tmux source-file ~/.tmux.conf
# Useful plugins for vim and tmux consistency
Plugin 'christoomey/vim-tmux-navigator' --> in vimrc
# -----------The following is for .tmux.conf -------------------------------------#
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
@wiccy46
wiccy46 / jenkins_basic.yml
Last active January 27, 2024 20:07
[jenkins_basic] Jenkins basics #jenkins
docker-compose.yml
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins
ports:
- "8080:8080"
volumes:
- "$PWD/jenkins_home:/var/jenkins_home"
@wiccy46
wiccy46 / docker_collection.sh
Last active May 10, 2020 16:19
[docker_collection] A collection of docker commands #docker
# Open a container
docker exec -it NAME bash
# Exit
exit
# Copy file to container
docker cp script.sh jenkins:/tmp/script.sh
@wiccy46
wiccy46 / vimbasic.txt
Last active November 30, 2020 08:08
[vimbasic]collection of vim basic #vim
Movement:
0 -- 到行头
$ -- 到行尾
fx -- 下一个x
; -- 重复 f t F T
^ b -- 倒一页
^ f -- 进一页
zt or z<CR> -- Move current line top of the screen
z. or zz -- Move cl center of screen