2016年9月27日 星期二

[C] 分別用locker 跟 pipe 同步.

locker : pipe :

[C] how to use Union ?

[GUN C]Re-execute itself from elf file.

Re-execute itself from elf file.

2016年8月2日 星期二

How to create a soft or symbolic link?

Q:
I am installing p4v in /opt, but /usr/bin is on my path. Is it possible to create a soft or symbolic link for p4v from /opt to /usr/bin, so I can just type "p4v" since /usr/bin is in my path?

A:

  1. ln -s /<full>/<path>/<to>/<file> /usr/local/bin
  2. It would be a better way as below:
    echo "export PATH=\$PATH:/opt/bin" >> ~/.bashrc
    . ~/.bashrc

2016年7月31日 星期日

[solved] How to repair the qemu image file.

Question : Image is corrupt; cannot be opened read/write
qemu-img check -r all /work/vdisk/ceph_centos65_x86_64_ceph_osd1.img

2016年5月16日 星期一

Setup the gcc 6 by rpm package without compiling by myself.

Setup the gcc 6 by rpm package :
Firstly, I downloaded the gcc6 source code from official website compiling it by myself.
When I compiled the to-be-fuzz kernel, it show do not support -fsanitize-coverage=trace-pc by compiler.
linux-0tla:~/kernel # sh -xx scripts/gcc-x86_64-has-stack-protector.sh gcc-6 rpm -Vqf `which gcc-6` linux-0tla:~/kernel # rpm -Vqf /usr/bin/gcc-6 Unsatisfied dependencies for gcc6-6.1.1+r235696-19.2.x86_64: cpp6 = 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libasan3 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libatomic1 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libcilkrts5 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libgcc_s1 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libgomp1 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libisl.so.15()(64bit) is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libitm1 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 liblsan0 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libtsan0 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 libubsan0 >= 6.1.1+r235696-19.2 is needed by (installed) gcc6-6.1.1+r235696-19.2.x86_64 Thus, I typed the command `zypper ar [repo url]` & `zypper update` it.
And then, I saw above libraries installing them.

2016年2月29日 星期一

[C] Insertion Sort

  • 原理 : 將資料逐一插入以排序好的序列中
  • Algorithm : 
                    for i <- 2 to n do
                                     將a[i] 插入 a[1] ~ a[i-1] 之間適當的位置,使a[1]~a[i]排好

  • Code :
from : https://study.cs50.net/insertion_sort