This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before backup: | |
dpkg --get-selections > packages.txt | |
while restoring: | |
dpkg --clear-selections | |
dpkg --set-selections < packages.txt | |
aptitude install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% https://tex.stackexchange.com/a/273223/124998 | |
\documentclass[a4paper]{article} | |
\usepackage{tcolorbox} | |
\tcbuselibrary{skins} | |
\title{ | |
\vspace{-3em} | |
\begin{tcolorbox}[colframe=white,opacityback=0] | |
\begin{tcolorbox} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# STL GDB evaluators/views/utilities - 1.03 | |
# | |
# The new GDB commands: | |
# are entirely non instrumental | |
# do not depend on any "inline"(s) - e.g. size(), [], etc | |
# are extremely tolerant to debugger settings | |
# | |
# This file should be "included" in .gdbinit as following: | |
# source stl-views.gdb or just paste it into your .gdbinit file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://askubuntu.com/a/1000020/657385 | |
ffmpeg -i file_orig.mp3 -acodec copy file_fixed.mp3 | |
# https://www.xmodulo.com/convert-mp3-id3-tag-encodings-linux.html | |
mid3iconv -e gbk/big5 -d input.mp3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://unix.stackexchange.com/a/501546/215915 | |
env LC_ALL=zh_CN.GB2312 7z x file.zip | |
convmv -f zh_CN.GB2312 -t UTF8 -r . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert passport.jpg -background transparent -fill black -size 1024x256 -pointsize 24 -gravity center -annotate +0+205 'For ... Purpose' passport-water.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://wiki.archlinux.org/title/Rsync#Full_system_backup | |
rsync -aAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup | |
# More human readable | |
rsync -aAXHh --info=progress2 --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% https://tex.stackexchange.com/a/84763/124998 | |
\usepackage{pgfpages} | |
\setbeameroption{show notes} | |
\setbeameroption{show notes on second screen=right} | |
% Command line: | |
% pdfpc --notes=right presentation.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://askubuntu.com/a/50180 | |
pdftoppm -png -r 300 input.pdf png/out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lens = [3, 5, 4] | |
# What we want: | |
# mask = [[1, 1, 1, 0, 0], | |
# [1, 1, 1, 1, 1], | |
# [1, 1, 1, 1, 0]] | |
# https://stackoverflow.com/questions/53403306/how-to-batch-convert-sentence-lengths-to-masks-in-pytorch | |
def len_to_mask(lens: np.ndarray, seq_len: Optional[int] = None) -> np.ndarray: | |
if seq_len is None: | |
seq_len = max(lens) |
NewerOlder