跳至主要内容

博文

目前显示的是 六月, 2020的博文

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 &

learning some sbt fu by build the bfg tool excerpt: sbt 1 2 3

I want to build the bfg tool In my previous blog I talked about bfg the bfg-repo-cleaner . It is a fast repo maintain tool written in scala. The developer didn't provide any prebuilt binary downloads. So, clone and built by myself. SBT do not work well the maven way After some simple git clone. Backed with some maven knowledge and knowing that sbt is kind of same tool. I thought like a fool that a sdk install sbt followed by sbt build command will built a beautiful jar in target directory as maven package do. Sbt version mismatch Quickly, I learn the first lesson from sbt: sbt will not build the old project with latest sbt version, it will always try to build the project with declared version. If the version is not available locally, SBT will try to download it until successes with the downloading. sbt will download with project declared sbt version if not already installed. sbt will download the project declared scala version if not already installed. s

What is git-lfs and how to convert existing repo

What is git-lfs According to its name, git-lfs is git-large-file-storage. Is a git plugin which replace large file to their corresponding text pointers in git repo. This way it accelerates git fetch process by only download needed large file objects. Why git-lfs? Git service provider such as GitHub and bitbucket are both activated the git-lfs on their service. Actually, github also setup a hook that will reject commits with large binary files. If you have a legacy git repository and want to host it on GitHub, you must make sure there's no large binary files ever checked into your repo in the past. What if you got a poisoned repo full of large binary files? There are no many options to choose from when you are in this situation. Convert or migrate to git-lfs repo. Drop the history, as huge git-lfs do cost money. Both github and bitbucket set 1GB limit on their free git-lfs storage capacity. Enable git-lfs in new repo and Convert existing repo to git-

libgusetfs tools and virt-sparsify excerpt: Don't forget the virt-sparsify tool again

libguestfs tools and virt-sparsify I missed the tool so much that I've been re -google for key word "qcow2 compress", "qcow2 space claim", "libguestfs compress" and etc. for a whole day!!! Here's the manpage: http://libguestfs.org/virt-sparsify.1.html It is much better than the pure qemu-img convert -c -f a.qcow2 -O qcow2 compressed_a.qcow2 command.

Data vis tool for python excerpt: Some conconsion of recently leart on python data vis

Data Visualizing with Python These what I learn by evaluate the tools in jupyter notebook/lab matplotlib Ready to use when imported Minimum setup needs to be done for picture size seaborn Will be activated after import. No special syntax needed as it is just a set of beautiful themes for matplotlib. plotly The plotly Python library (plotly.py) is an interactive, open-source plotting library that supports over 40 unique chart types covering a wide range of statistical, financial, geographic, scientific, and 3-dimensional use-cases.