跳至主要内容

博文

Eglot mode with MS pylance language server

Step by Step how-to follows Install Pylance by any means. I did it by install it from VS Code plugin manager. (You know, language server is the VS Code thing). Install nodejs by any means. I did it by doing a choco install nodejs . In emacs M-x package-list-packages search for eglot-mode mark it to be installed with key i , then hit key x to install. Configure Emacs to initialize package-system and elgot by adding the following elisp snippets to init.el . ( require ' package ) (package-initialize) ( require ' eglot ) ;; VSCode install extentions in ~/.vscode or %UserProfile%\.vscode directory. e.g. ;; C:\\Users\\ekaifan\\.vscode\\extensions\\ms-python.vscode-pylance-2020.8.2\\server\\server.bundle.js (add-to-list 'eglot-server-programs '(python-mode . ( "node" "PATH_TO_YOUR_PYLANCE_SERVER_DOT_BUNDLE_DOT_JS" "--stdio" ))) (add-hook 'python-mode-hook 'eglot-ensure) Customize your eglot behavior by M-x customize-group...

bfg is not always perfect

When something broken in your git lfs workflow It is awful when this happened in your packaging procedure. Image that, everything should have been a binary archive being end in a text point file in your installation media.. Nightmare.. So how could it happen? All begins with a repo optimization.. You have a repo full of binary files, and you want it to be clean and neat. You know that bfg will help you on the job. And did the convention with some magic file pattern like *.{jpg,png,zip,gz,tar} Then you replaced the repo, without any sanity test. Git lfs pointer files begins to show up in your source tree You got this after every git operation, as the git hooks did not work as expected. They don’t understand bfg generated filter rules in your .gitattribute file. Git lfs files shows as modfied after git lfs pull You know that git lfs pull can help you with pointer file => binary convertion. But it do not help much, as everything converted...

Use keeagent as ssh-agent for openssh clients inside WSL

A great python to save keepass WSL user in windows If you are a keepass user, chances are that you are also a keeagent user, chances are that you are also a WSL user. You want all your passwords and ssh keys managed by keepass , and automatically served by the great keeagent plugin. As with putty, mobaxterm, git bash, win10 bundled OpenSSH all works well with trivial additional setup. You will expect the real OpenSSH inside your WSL environment to work as well. msysgit2unix-socket.py Get the tool and setup it in your WSL, and then you get it. Try ssh-add -l or ssh to any of your usual ssh target after restart your WSL terminal. https://gist.github.com/kevinvalk/3ccd5b360fd568862b4a397a9df9ed26

Use rmdir instead of del to delete the symblic link (itself) in windows to prevent data loss

Use rmdir if you want to remove just the directory symbolic link (by itself.) When you begin to live with (make use of) symbolic links in windows. You may have to remove some symbolic links for maintenance. It feels all okay until symbolic links whose target are directories, those created by /d parameters by `mklink` tool, comes into play. Don't use the del command, as it will recursively delete all the files under the target directory. Use rmdir to delete just the symbolic link itself. Reference: https://superuser.com/questions/167076/how-can-i-delete-a-symbolic-link

Learning terraform with OCI provider and Oracle always free tier

Provider: OCI https://www.terraform.io/docs/providers/oci/index.html Initial terraform plugins. Setup connection credentials as input variables, such various ocids, public keys etc. The way of using .tfvars file is deprecated. The way of configuring via SDK/CLI configuration file ~/.oci/config does not work. Shell variables work as expected. An exist oci resource, such as vcn, must be removed before always free configuration can be applied. OCI stacks is actually implemented with terraform. There's terraform specific functions in stack's detail panel. Such as terraform configuration download (as a zip), plan, apply, destroy. Long way to go as OCI api is rich and complex.  

emulate htop with top

The top program from procps-ng (debian, centos/el7 later) Ever being with htop for some time and miss the process tree and graphical CPU/memory usage? The top program from procps-ng (debian, centos/el7 later) can easily emulate the presentation of htop view. Start the top program, it looks like following with its default configuration: top - 09:20:54 up 307 days, 22:58, 4 users, load average: 0.80, 0.74, 0.75 Tasks: 486 total, 1 running, 485 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.6 us, 0.6 sy, 0.0 ni, 98.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 65796532 total, 808264 free, 22970744 used, 42017524 buff/cache KiB Swap: 16777212 total, 15433868 free, 1343344 used. 39944388 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 30561 clouder+ 20 0 16.0g 2.3g 23296 S 11.6 3.6 11037:25 java 703 yarn 20 0 2586468 429556 20704 S 1.0 0.7 258:14.48 java 10 root 20 0 0 0 0 S 0.7...

chcon can not apply partial context to unlabeld file excerpt: fix broken selinux label

The broken selinux label and way to fix Yesterday I work on a task of compress a qcow2 vm image. As usual I made a temp directory in the directory of the image, and fired the qemu-img convert and then virt-sparsify command to do the compression. Soon, after some seconds, an unusual error occurred. My task received a mysterious signal 9 and exited. As I am the only user of the machine at the time. A blind guess and some ls -lhz commands lead me to the broken selinux label problem. It turns out that directory up to the second level of the directory are all unlabeled. My first attempt with chcon -R -t virt_image_t <workdir> failed with some error messages looks like bellow: chcon: can't apply partial context to unlabeled file 'VERSION.png' chcon: can't apply partial context to unlabeled file '1.1_V12' chcon: can't apply partial context to unlabeled file 'pre-release' chcon: can't apply partial context to unlabeled file ...