小代码大作用:电脑开荒代码: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 64: | Line 64: | ||
# 用于把电脑上的文件快速传到手机上的 01 文件夹 | # 用于把电脑上的文件快速传到手机上的 01 文件夹 | ||
adb push $1 /sdcard/01 | adb push $1 /sdcard/01 | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash" line> | |||
# server | |||
alias s='ls -hl --ignore={Desktop,Documents,Music,Pictures,Public,Templates,Videos}' | |||
alias e='emacs --eval "(load-theme (quote adwaita))"' | |||
alias eq='emacs -Q --eval "(load-theme (quote adwaita))"' | |||
alias eb='emacs -Q --eval "(load-theme (quote adwaita))" /home/$USER/.bashrc' | |||
alias se='sudo emacs -Q --eval "(load-theme (quote adwaita))"' | |||
alias gwk='sudo emacs -Q --eval "(load-theme (quote adwaita))" /etc/mediawiki/LocalSettings.php' | |||
alias sb='source /home/$USER/.bashrc' | |||
alias as='apt search --names-only' | |||
alias ai='sudo apt install' | |||
alias au='sudo apt update' | |||
alias gc='git clone' | |||
alias rmd='rm -rf' | |||
eval "$(lua /home/$USER/Sources/z.lua/z.lua --init bash enhanced once)" | |||
# gui | |||
alias bye='systemctl suspend' | |||
alias sr='systemctl reboot' | |||
alias sp='systemctl poweroff' | |||
alias f='f.sh' | |||
alias gfw='gfw.sh' | |||
alias ff='firefox-esr -p >>/dev/null 2>&1 &' | |||
alias nl='firefox-esr -p Offline $1' | |||
alias sj='scrcpy -S >>/dev/null 2>&1 &' | |||
alias a2sj='a2sj.sh' | |||
alias gt='./gt.sh' | |||
alias p3='python3' | |||
alias tl='sudo tldr' | |||
alias pip='pip3' | |||
alias python='python3' | |||
export PATH=$PATH:~/tsh:/home/qlzq/.local/bin | |||
export STARDICT_DATA_DIR=/home/qlzq/Documents/En | |||
if [ -f ~/.Xmodmap ]; then xmodmap ~/.Xmodmap; fi | |||
# # Install Ruby Gems to ~/gems | |||
# export GEM_HOME="$HOME/gems" | |||
# export PATH="$HOME/gems/bin:$PATH" | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 14:09, 19 September 2023
某一天,你拿到了一台新电脑。或者,某一天,你的电脑系统崩溃了。你需要从头配置一套从前习惯的工具链,那么,以下这些小代码,非常有用。请在你理解用处、并自担风险的情况下使用。
Windows 平台
# set-network-private.ps1
# 用于把公用网络改为私用网络,实现全屋共享。需以管理员权限运行:创建快捷方式,目标选本文件
Set-NetConnectionProfile -InterfaceAlias "以太网" -NetworkCategory Private
# shutdown.bat
# 用于双击立即关机,省下从开始键点好几下才关机的工夫
@echo off
shutdown.exe /s /t 00
# 右键创建快捷方式
# 在桌面双击就可以直达知乎
"C:\Program Files\Mozilla Firefox\firefox.exe" https://www.zhihu.com
Debian 平台
#!/bin/bash
# 用于查找本目录下的文件,不区分文件名大小写。包含查找的关键字就可以查到。不想换行该怎么写呢?其实用变量参数$1即可,但两行更方便,符合直觉
read text
find . -iname "*$text*"
#!/bin/bash
# 用于比较文件 hash 值,确认文件是否为原版无更改
echo "input origin > "
read origin
echo "input local > "
read local
if [ ${origin,,} = ${local,,} ]; then
echo "相等"
else
echo "有问题"
fi
#!/bin/bash
# 用于把在电脑上修改过的 rime 配置文件,推送到手机上,并自动重新部署手机端同文输入法
adb shell ime disable com.osfans.trime/.TrimeImeService
adb shell am force-stop com.osfans.trime
adb shell rm -r /sdcard/rime
adb shell mkdir /sdcard/rime
adb push /home/qlzq/500/Code/ok-trime/* /sdcard/rime
adb shell ime enable com.osfans.trime/.TrimeImeService
adb shell ime set com.osfans.trime/.TrimeImeService
adb shell am broadcast -a com.osfans.trime.deploy
#!/bin/bash
# 用于把电脑上的文件快速传到手机上的 01 文件夹
adb push $1 /sdcard/01
# server
alias s='ls -hl --ignore={Desktop,Documents,Music,Pictures,Public,Templates,Videos}'
alias e='emacs --eval "(load-theme (quote adwaita))"'
alias eq='emacs -Q --eval "(load-theme (quote adwaita))"'
alias eb='emacs -Q --eval "(load-theme (quote adwaita))" /home/$USER/.bashrc'
alias se='sudo emacs -Q --eval "(load-theme (quote adwaita))"'
alias gwk='sudo emacs -Q --eval "(load-theme (quote adwaita))" /etc/mediawiki/LocalSettings.php'
alias sb='source /home/$USER/.bashrc'
alias as='apt search --names-only'
alias ai='sudo apt install'
alias au='sudo apt update'
alias gc='git clone'
alias rmd='rm -rf'
eval "$(lua /home/$USER/Sources/z.lua/z.lua --init bash enhanced once)"
# gui
alias bye='systemctl suspend'
alias sr='systemctl reboot'
alias sp='systemctl poweroff'
alias f='f.sh'
alias gfw='gfw.sh'
alias ff='firefox-esr -p >>/dev/null 2>&1 &'
alias nl='firefox-esr -p Offline $1'
alias sj='scrcpy -S >>/dev/null 2>&1 &'
alias a2sj='a2sj.sh'
alias gt='./gt.sh'
alias p3='python3'
alias tl='sudo tldr'
alias pip='pip3'
alias python='python3'
export PATH=$PATH:~/tsh:/home/qlzq/.local/bin
export STARDICT_DATA_DIR=/home/qlzq/Documents/En
if [ -f ~/.Xmodmap ]; then xmodmap ~/.Xmodmap; fi
# # Install Ruby Gems to ~/gems
# export GEM_HOME="$HOME/gems"
# export PATH="$HOME/gems/bin:$PATH"