menu Chancel's Blog
rss_feed lightbulb_outline

我的笔记

Markdown - 代码块语言标注支持名称列表(Python3)

经常使用Markdown语法,但对于代码块开头的三个分号```后面注解的语言类型一直属于想到什么写什么

使用Markdown解析器之后发现这一部分是有明确规范的写法的,于是从Python的pygments lexers 中提取这一部分解析列表出来,应该覆盖了绝大部分的语言缩写了

编程语言 支持的缩写
ABAP abap
AMDGPU amdgpu
APL apl
ABNF abnf
ActionScript 3 as3, actionscript3
ActionScript as, actionscript
Ada ada, ada95, ada2005
ADL adl
Agda agda
Aheui aheui
Alloy alloy
AmbientTalk at, ambienttalk, ambienttalk/2
Ampl ampl
HTML + Angular2 html+ng2
Angular2 ng2
ANTLR With ActionScript Target antlr-as, antlr-actionscript
ANTLR With C# Target antlr-csharp, antlr-c#
ANTLR With CPP Target antlr-cpp
ANTLR With Java Target antlr-java
ANTLR antlr
ANTLR With ObjectiveC Target antlr-objc
ANTLR With Perl Target antlr-perl
ANTLR With Python Target antlr-python
ANTLR With Ruby Target antlr-ruby, antlr-rb
ApacheConf apacheconf, aconf, apache
AppleScript applescript
Arduino arduino
Arrow arrow
AspectJ aspectj
Asymptote asy, asymptote
Augeas augeas
AutoIt autoit
autohotkey ahk, autohotkey
Awk awk, gawk, mawk, nawk
BBC Basic bbcbasic
BBCode bbcode
BC bc
BST bst, bst-pybtex
BARE bare
Base Makefile basemake
Bash bash, sh, ksh, zsh, shell
Bash Session console, shell-session
Batchfile bat, batch, dosbatch, winbatch
Befunge befunge
BibTeX bib, bibtex
BlitzBasic blitzbasic, b3d, bplus
BlitzMax blitzmax, bmax
BNF bnf
Boa boa
Boo boo
Boogie boogie
Brainfuck brainfuck, bf
BUGS bugs, winbugs, openbugs
CAmkES camkes, idl4
C c
CMake cmake
c-objdump c-objdump
CPSA cpsa
aspx-cs aspx-cs
C# csharp, c#
ca65 assembler ca65
cADL cadl
CapDL capdl
Cap'n Proto capnp
CBM BASIC V2 cbmbas
CDDL cddl
Ceylon ceylon
CFEngine3 cfengine3, cf3
ChaiScript chai, chaiscript
Chapel chapel, chpl
Charmci charmci
HTML+Cheetah html+cheetah, html+spitfire, htmlcheetah
JavaScript+Cheetah js+cheetah, javascript+cheetah, js+spitfire, javascript+spitfire
Cheetah cheetah, spitfire
XML+Cheetah xml+cheetah, xml+spitfire
Cirru cirru
Clay clay
Clean clean
Clojure clojure, clj
ClojureScript clojurescript, cljs
COBOLFree cobolfree
COBOL cobol
CoffeeScript coffee-script, coffeescript, coffee
Coldfusion CFC cfc
Coldfusion HTML cfm
cfstatement cfs
Common Lisp common-lisp, cl, lisp
Component Pascal componentpascal, cp
Coq coq
C++ cpp, c++
cpp-objdump cpp-objdump, c++-objdumb, cxx-objdump
Crmsh crmsh, pcmk
Croc croc
Cryptol cryptol, cry
Crystal cr, crystal
Csound Document csound-document, csound-csd
Csound Orchestra csound, csound-orc
Csound Score csound-score, csound-sco
CSS+Django/Jinja css+django, css+jinja
CSS+Ruby css+erb, css+ruby
CSS+Genshi Text css+genshitext, css+genshi
CSS css
CSS+PHP css+php
CSS+Smarty css+smarty
CUDA cuda, cu
Cypher cypher
Cython cython, pyx, pyrex
D d
d-objdump d-objdump
Darcs Patch dpatch
Dart dart
DASM16 dasm16
Debian Control file control, debcontrol
Delphi delphi, pas, pascal, objectpascal
Devicetree devicetree, dts
dg dg
Diff diff, udiff
Django/Jinja django, jinja
Docker docker, dockerfile
DTD dtd
Duel duel, jbst, jsonml+bst
Dylan session dylan-console, dylan-repl
Dylan dylan
DylanLID dylan-lid, lid
ECL ecl
eC ec
Earl Grey earl-grey, earlgrey, eg
Easytrieve easytrieve
EBNF ebnf
Eiffel eiffel
Elixir iex session iex
Elixir elixir, ex, exs
Elm elm
EmacsLisp emacs, elisp, emacs-lisp
E-mail email, eml
ERB erb
Erlang erlang
Erlang erl session erl
HTML+Evoque html+evoque
Evoque evoque
XML+Evoque xml+evoque
execline execline
Ezhil ezhil
F# fsharp, f#
FStar fstar
Factor factor
Fancy fancy, fy
Fantom fan
Felix felix, flx
Fennel fennel, fnl
Fish fish, fishshell
Flatline flatline
FloScript floscript, flo
Forth forth
FortranFixed fortranfixed
Fortran fortran
FoxPro foxpro, vfp, clipper, xbase
Freefem freefem
Futhark futhark
GAP gap
GDScript gdscript, gd
GLSL glsl
GAS gas, asm
Genshi genshi, kid, xml+genshi, xml+kid
Genshi Text genshitext
Gettext Catalog pot, po
Gherkin cucumber, gherkin
Gnuplot gnuplot
Go go
Golo golo
GoodData-CL gooddata-cl
Gosu gosu
Gosu Template gst
Graphviz graphviz, dot
Groff groff, nroff, man
Groovy groovy
HLSL hlsl
Haml haml
HTML+Handlebars html+handlebars
Handlebars handlebars
Haskell haskell, hs
Haxe hx, haxe, hxsl
Hexdump hexdump
HSAIL hsail, hsa
Hspec hspec
HTML+Django/Jinja html+django, html+jinja, htmldjango
HTML+Genshi html+genshi, html+kid
HTML html
HTML+PHP html+php
HTML+Smarty html+smarty
HTTP http
Hxml haxeml, hxml
Hy hylang
Hybris hybris, hy
IDL idl
Icon icon
Idris idris, idr
Igor igor, igorpro
Inform 6 inform6, i6
Inform 6 template i6t
Inform 7 inform7, i7
INI ini, cfg, dosini
Io io
Ioke ioke, ik
IRC logs irc
Isabelle isabelle
J j
JAGS jags
Jasmin jasmin, jasminxt
Java java
JavaScript+Django/Jinja js+django, javascript+django, js+jinja, javascript+jinja
JavaScript+Ruby js+erb, javascript+erb, js+ruby, javascript+ruby
JavaScript+Genshi Text js+genshitext, js+genshi, javascript+genshitext, javascript+genshi
JavaScript js, javascript
JavaScript+PHP js+php, javascript+php
JavaScript+Smarty js+smarty, javascript+smarty
JCL jcl
JSGF jsgf
JSONBareObject
JSON-LD jsonld, json-ld
JSON json, json-object
Java Server Page jsp
Julia console jlcon
Julia julia, jl
Juttle juttle
Kal kal
Kconfig kconfig, menuconfig, linux-config, kernel-config
Kernel log kmsg, dmesg
Koka koka
Kotlin kotlin
LSL lsl
CSS+Lasso css+lasso
HTML+Lasso html+lasso
JavaScript+Lasso js+lasso, javascript+lasso
Lasso lasso, lassoscript
XML+Lasso xml+lasso
Lean lean
LessCss less
Lighttpd configuration file lighty, lighttpd
Limbo limbo
liquid liquid
Literate Agda lagda, literate-agda
Literate Cryptol lcry, literate-cryptol, lcryptol
Literate Haskell lhs, literate-haskell, lhaskell
Literate Idris lidr, literate-idris, lidris
LiveScript live-script, livescript
LLVM llvm
LLVM-MIR Body llvm-mir-body
LLVM-MIR llvm-mir
Logos logos
Logtalk logtalk
Lua lua
MIME mime
MOOCode moocode, moo
MSDOS Session doscon
Makefile make, makefile, mf, bsdmake
CSS+Mako css+mako
HTML+Mako html+mako
JavaScript+Mako js+mako, javascript+mako
Mako mako
XML+Mako xml+mako
MAQL maql
markdown md, markdown
Mask mask
Mason mason
Mathematica mathematica, mma, nb
Matlab matlab
Matlab session matlabsession
MiniD minid
MiniScript ms, miniscript
Modelica modelica
Modula-2 modula2, m2
MoinMoin/Trac Wiki markup trac-wiki, moin
Monkey monkey
Monte monte
MoonScript moon, moonscript
Mosel mosel
CSS+mozpreproc css+mozpreproc
mozhashpreproc mozhashpreproc
Javascript+mozpreproc javascript+mozpreproc
mozpercentpreproc mozpercentpreproc
XUL+mozpreproc xul+mozpreproc
MQL mql, mq4, mq5, mql4, mql5
Mscgen mscgen, msc
MuPAD mupad
MXML mxml
MySQL mysql
CSS+Myghty css+myghty
HTML+Myghty html+myghty
JavaScript+Myghty js+myghty, javascript+myghty
Myghty myghty
XML+Myghty xml+myghty
NCL ncl
NSIS nsis, nsi, nsh
NASM nasm
objdump-nasm objdump-nasm
Nemerle nemerle
nesC nesc
NewLisp newlisp
Newspeak newspeak
Nginx configuration file nginx
Nimrod nim, nimrod
Nit nit
Nix nixos, nix
Notmuch notmuch
NuSMV nusmv
NumPy numpy
objdump objdump
Objective-C objective-c, objectivec, obj-c, objc
Objective-C++ objective-c++, objectivec++, obj-c++, objc++
Objective-J objective-j, objectivej, obj-j, objj
OCaml ocaml
Octave octave
ODIN odin
Ooc ooc
Opa opa
OpenEdge ABL openedge, abl, progress
PacmanConf pacmanconf
Pan pan
ParaSail parasail
Pawn pawn
PEG peg
Perl6 perl6, pl6, raku
Perl perl, pl
PHP php, php3, php4, php5
Pig pig
Pike pike
PkgConfig pkgconfig
PL/pgSQL plpgsql
Pointless pointless
Pony pony
PostScript postscript, postscr
PostgreSQL console (psql) psql, postgresql-console, postgres-console
PostgreSQL SQL dialect postgresql, postgres
POVRay pov
PowerShell powershell, posh, ps1, psm1
PowerShell Session ps1con
Praat praat
Prolog prolog
PromQL promql
Properties properties, jproperties
Protocol Buffer protobuf, proto
PsySH console session for PHP psysh
Pug pug, jade
Puppet puppet
PyPy Log pypylog, pypy
Python 2.x python2, py2
Python 2.x Traceback py2tb
Python console session pycon
Python python, py, sage, python3, py3
Python Traceback pytb, py3tb
QBasic qbasic, basic
QVTO qvto, qvt
QML qml, qbs
RConsole rconsole, rout
Relax-NG Compact rnc, rng-compact
RPMSpec spec
Racket racket, rkt
Ragel in C Host ragel-c
Ragel in CPP Host ragel-cpp
Ragel in D Host ragel-d
Embedded Ragel ragel-em
Ragel in Java Host ragel-java
Ragel ragel
Ragel in Objective C Host ragel-objc
Ragel in Ruby Host ragel-ruby, ragel-rb
Raw token data
Rd rd
ReasonML reason, reasonml
REBOL rebol
Red red, red/system
Redcode redcode
reg registry
ResourceBundle resource, resourcebundle
Rexx rexx, arexx
RHTML rhtml, html+erb, html+ruby
Ride ride
Roboconf Graph roboconf-graph
Roboconf Instances roboconf-instances
RobotFramework robotframework
RQL rql
RSL rsl
reStructuredText rst, rest, restructuredtext
TrafficScript rts, trafficscript
Ruby irb session rbcon, irb
Ruby rb, ruby, duby
Rust rust, rs
SAS sas
S splus, s, r
Standard ML sml
SARL sarl
Sass sass
Scala scala
Scaml scaml
scdoc scdoc, scd
Scheme scheme, scm
Scilab scilab
SCSS scss
ShExC shexc, shex
Shen shen
Sieve sieve
Silver silver
Singularity singularity
Slash slash
Slim slim
Slurm slurm, sbatch
Smali smali
Smalltalk smalltalk, squeak, st
SmartGameFormat sgf
Smarty smarty
Snobol snobol
Snowball snowball
Solidity solidity
SourcePawn sp
Debian Sourcelist sourceslist, sources.list, debsources
SPARQL sparql
SQL sql
sqlite3con sqlite3
SquidConf squidconf, squid.conf, squid
Scalate Server Page ssp
Stan stan
Stata stata, do
SuperCollider sc, supercollider
Swift swift
SWIG swig
systemverilog systemverilog, sv
TAP tap
Typographic Number Theory tnt
TOML toml
TADS 3 tads3
TASM tasm
Tcl tcl
Tcsh tcsh, csh
Tcsh Session tcshcon
Tea tea
Tera Term macro ttl, teraterm, teratermmacro
Termcap termcap
Terminfo terminfo
Terraform terraform, tf
TeX tex, latex
Text only text
Thrift thrift
tiddler tid
Todotxt todotxt
Transact-SQL tsql, t-sql
Treetop treetop
Turtle turtle
HTML+Twig html+twig
Twig twig
TypeScript ts, typescript
TypoScriptCssData typoscriptcssdata
TypoScriptHtmlData typoscripthtmldata
TypoScript typoscript
ucode ucode
Unicon unicon
UrbiScript urbiscript
USD usd, usda
VBScript vbscript
VCL vcl
VCLSnippets vclsnippets, vclsnippet
VCTreeStatus vctreestatus
VGL vgl
Vala vala, vapi
aspx-vb aspx-vb
VB.net vb.net, vbnet
HTML+Velocity html+velocity
Velocity velocity
XML+Velocity xml+velocity
verilog verilog, v
vhdl vhdl
VimL vim
WDiff wdiff
Web IDL webidl
Whiley whiley
X10 x10, xten
XQuery xquery, xqy, xq, xql, xqm
XML+Django/Jinja xml+django, xml+jinja
XML+Ruby xml+erb, xml+ruby
XML xml
XML+PHP xml+php
XML+Smarty xml+smarty
Xorg xorg.conf
XSLT xslt
Xtend xtend
xtlang extempore
YAML+Jinja yaml+jinja, salt, sls
YAML yaml
YANG yang
Zeek zeek, bro
Zephir zephir
Zig zig

Develop Base 2021-03-25 05:25:25 location_on

Python3 - 让脚本支持绝对路径启动

对于Python的写成YAML配置文件导入Logging模块应用来说,通常会导致在当前运行目录下生成logs文件夹

但我们运行项目通常是希望在项目目录下生成logs文件夹的,无论在哪一个目录启动Python项目,我们都更希望默认启动路径是项目的绝对路径

使用下面的代码放在入口方法处可以切换全局的Python项目启动路径为项目的绝对路径

import os

os.chdir(os.path.abspath(os.path.dirname(os.path.abspath(__file__))))

Develop Technology Python 2021-03-23 03:01:59 location_on

Docker - 如何备份已运行的容器(迁移/导出)

在NAS上运行的Docker容器PhotoPrism需要备份以防万一(当然备份原始照片数据更重要)

备份步骤

  1. commit container
  2. save container to tar file

恢复步骤

  1. load container by tar file

全部步骤指令

# 打印当前所有容器
❯ docker ps
CONTAINER ID   IMAGE                          COMMAND                  CREATED       STATUS       PORTS                     NAMES
a48bc98b4a21   photoprism/photoprism:latest   "/entrypoint.sh phot…"   2 weeks ago   Up 5 hours   0.0.0.0:32342->2342/tcp   chancel_photoprism_1
f1d7d5ac091f   mariadb:10.5                   "docker-entrypoint.s…"   2 weeks ago   Up 5 hours   3306/tcp                  chancel_mariadb_1

# 提交需要备份的容器
❯ docker commit -p a48bc98b4a21 photoprism-container-backup

# 查看镜像列表
❯ docker images
REPOSITORY                    TAG       IMAGE ID       CREATED         SIZE
photoprism-container-backup   latest    cc71161fb644   4 minutes ago   14.3GB
hello-world                   latest    d1165f221234   2 weeks ago     13.3kB
mariadb                       10.5      e27cf5bc24fe   2 weeks ago     401MB
photoprism/photoprism         latest    f81f7b1e47a4   3 weeks ago     1.3GB

# 导出已保存的镜像备份为tar压缩文件
❯ docker save -o ~/photoprism-container-backup.tar photoprism-container-backup

# 导入已保存的镜像备份tar文件
❯ docker load -i ~/photoprism-container-backup.tar

# 重新使用镜像运行容器
docker run -d -p 32342:2342 container-backup photoprism-container-backup

Virtualization Technology 2021-03-22 15:53:05 location_on

Gnome3 - 改变切换工作台(多桌面)快捷键

Gnome的切换桌面默认快捷键是 Ctrl + Alt + Left/Right,与Windows10的多桌面切换快捷键(Ctrl + Super + Left/Right)不同。

经常在两个操作系统之间切换不一样的桌面切换快捷键还是很烦的,尤其是QQ音乐的默认切歌快捷键与Gnome桌面切换一致导致我莫名其妙的切歌了

修改Gnome快捷键需要安装 dconf-editor 工具,不同系统安装方法不一样,我用的是Manjaro,安装如下

sudo pacman -S dconf-editor

之后在终端运行 dconf-editor 命令呼出修改界面,依次选择 org - gnome - desktop - vm -keybindings ,然后找到switch-to-workspace修改即可

或者直接右上角搜索,输入“org.gnome.desktop.wm.keybindings”也可以直接定位到修改界面

如图,自行修改switch-to-workspace按键即可

Operating System Linux 2021-03-22 07:58:17 location_on

TL-WDR7650 - Mesh路由器丢包问题解决

家里使用2个TPLink的7650路由器进行Mesh组网,用了2年都没什么大问题,最近偶发发现外网FRP访问到NAS的速度奇慢无比

回来检查了下,发现挂FRP的设备用网线直连母路由器,NAS网线直连子路由器

但这两者之前丢包在15%-30%之间,仔细检查各项配置无误后初步怀疑如下

  1. 网线问题
  2. 路由器问题

因为内网应该不涉及到网关问题,家里网络是比较特殊的单臂路由,在切换回正常主路由模式下仍然丢包严重,更换网线也没有作用

尝试更新TL-WDR7650千兆易展版型号的新固件也没有效果,无奈地重置了母路由器的设置,问题果然神奇地解决了

果然实在不行重启,再不行恢复出厂设置总归可以解决

Network 2021-03-19 16:45:22 location_on

Linux 命令精进05

硬盘挂载步骤

  • 查找所有硬盘硬件信息
  • 选中需要挂载的硬盘进行分区
  • 分区完成后格式化硬盘分区
  • 将挂载硬盘的信息写入系统文件/etc/fstab

下面以格式化一个新增加的1G硬盘为例子

# 打印所有硬盘硬件信息
❯ sudo fdisk -l

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00087949

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    33554431    15727616   8e  Linux LVM

Disk /dev/mapper/centos-root: 14.4 GB, 14382268416 bytes, 28090368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 1719 MB, 1719664640 bytes, 3358720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


# 此处要初始化的盘是1G的硬盘,一般通过容量跟分区信息就可以判断出是哪一个硬盘,通过上面的输出信息可以得知是/dev/sdb
❯ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd01a716f.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-2097151, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): 
Using default value 2097151
Partition 1 of type Linux and of size 1023 MiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


# 硬盘创建分区之后还需要格式化
❯ sudo mkfs.ext4 /dev/sdb1 
sudo mkfs.ext4 /dev/sdb1 
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 261888 blocks
13094 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

# 将硬盘挂载信息写入硬盘文件/etc/fstab,然后尝试重启,如若重启有问题可以修改/etc/fstab来修复启动
❯ sudo echo '/dev/sdb1 /mnt/sdb1/ ext4 defaults 0 0' >> /etc/fstab
❯ sudo reboot

/etc/fstab文件格式

  • <filesystem> <mountpoint> <type> <opts> <dump> <pass>

格式解释

  • filesystem:挂载设备的位置或者UUID,例如/dev/sdb1,也可以写其唯一的UUID,通过/dev/disk/by-uuid/来确认,相对而言,/dev/sd[x]的位置是不会变化的,使用UUID则是更为保险的方法
  • mountpoint:挂载点,即这个硬盘挂载到哪一个文件夹下
  • type:文件系统类型,Linux支持非常多的文件系统挂载,包括但不限于ext2/ext3/ext4/xfs/ntfs/swap,也可以使用auto来代替手动指定,让系统自动判断文件系统类型
  • opts:这是挂载的时候最重要的参数,涉及到许多硬盘的参数,一般若无特殊要求使用 defauls即可
  • dump:备份命令,需要备份是1,无需备份是0,备份需要联合dump untility使用,较少使用,一般情况下都是使用0
  • pass:在系统启动时使用fsck工具检查扇区,0表示不检查,1表示尽快检查,2表示需要检查但无需过急,对于特殊分区如交换空间是不需要使用检查的

实际例子

  • UUID=96ddc5ee-78f7-43e4-abbd-8359cf73bdfc /mnt/sda/ ext4 defaults 0 0
  • /dev/sdb1 /mnt/sdb1/ ext4 defaults 0 0

Operating System Linux 2021-03-12 16:55:38 location_on

Ubuntu1804 - 开机脚本执行服务rc-local.service

Ubuntu1804改用systemd来管理系统后,rc-local服务默认不再开启,记录一下如何开启这个服务

首先检查 /etc/systemd/system/rc-local.service文件是否存在,如果不存在,则创建这个文件

sudo ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service

然后编辑 sudo vim /etc/systemd/system/rc-local.service文件,添加Install节点

[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

[Install]
WantedBy=multi-user.target
Alias=rc-local.service

最后创建一下开机需要执行的 rc.local文件,sudo vim /etc/rc.local*,这里添加一个开机输出一个文件的测试

#!/bin/bash
echo 'hello world' > /tmp/hello.txt

最后使用systemd来启动开机执行

sudo systemctl enable rc-local

Operating System Linux 2021-03-09 16:59:16 location_on

ProxyChains - Shell下优秀的终端代理软件

在Linux下终端使用代理可以利用 SET HTTP=http://127.0.0.1:8080的方法来完成当前shell的代理

但每一次都要设置非常烦,写入.bashrc文件的话又不见得每次登录Shell都需要使用代理

ProxyChains就可以很方便的做到需要代理的命令走代理,只需要在前面加上 proxychains,例如使用代理运行wget

proxychains wget https://www.chancel.ltd/sitemap

ProxyChains is a UNIX program, that hooks network-related libc functions in dynamically linked programs via a preloaded DLL and redirects the connections through SOCKS4a/5 or HTTP proxies.

各大发行版包管理器大部分都包含了ProxyChains,Ubuntu下安装ProxyChains

sudo apt install proxychains -y

安装完成之后修改一下位于/etc/proxychains.conf配置文件就可以使用了,打开文件后,在最下方添加你的代理信息,如下

...
#       proxy types: http, socks4, socks5
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
http 127.0.0.1:8080

Operating System Linux 2021-03-08 11:39:08 location_on

Genymotion - Error while creating virtualbox host-only interface

我的系统环境信息

  • Manjaro Linux 64Bit
  • Linux version 5.10.18-1

安装Genymotion

# 先更新系统
sudo pacman -Syuu
yay -S genymotion

然后运行Genymotion,提示错误

Error while creating virtualbox host-only interface

仔细查看安装输出,安装完成后需要运行命令

sudo modprobe vboxdrv

但在运行之后,提示输出找不到 Module vboxdrv not found,于是执行

sudo pacman -S virtualbox linux510-virtualbox-host-modules

linux510-virtualbox-host-modules 这个包取决于你的Linux内核版本,可以使用 cat /proc/version 查看内核版本

最后再次运行以下指令查看是否有异常提示

sudo modprobe vboxdrv
sudo modinfo vboxdrv
sudo modprobe vboxnetadp
sudo modprobe vboxnetflt

再次启动Genymotion,一切正常

Software Tools Linux 2021-03-02 20:59:20 location_on

Manjaro - 安装Fcitx5搭配肥猫百万词库

首先卸载所有关于fcitx4的包

sudo pacman -Rs $(pacman -Qsq fcitx)

安装fcitx5

sudo pacman -S fcitx5-im fcitx5-chinese-addons

配置环境变量 vim ~/.pam_environment

GTK_IM_MODULE DEFAULT=fcitx
QT_IM_MODULE  DEFAULT=fcitx
XMODIFIERS    DEFAULT=\@im=fcitx
SDL_IM_MODULE DEFAULT=fcitx

安装肥猫百万词库(从wiki上加载,按照官方说法并无版权风险)

yay -S fcitx5-pinyin-zhwiki

注销重启PC后,打开 fcitx Configuration,选择添加拼音即可使用

PS:如何验证词库加载成功?打个“贾跃亭”试试看能不能匹配出来

参考资料

Operating System Linux 2021-02-27 14:06:36 location_on

2 of 13 | A total of 128