Author Archives: cowman.chiang

[Docker] time sync with host

docker run -v /etc/localtime:/etc/localtime:ro -i -t mattdm/fedora /bin/bash Source: stackoverflow: How to make sure docker’s time syncs with that of the host?

Posted in Docker | Comments Off on [Docker] time sync with host

[Docker] Common commands

show all containers: docker ps -a stop all containers: docker kill $(docker ps -q) remove all containers: docker rm $(docker ps -a -q) remove all docker images: docker rmi $(docker images -q) enter docker container: docker exec -it $(container id) … Continue reading

Posted in Docker | Leave a comment

[HBase] security issue

error message: com.a.b.c.exception.BaseDAOException: org.apache.hadoop.hbase.security.AccessDeniedException: org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions for user ‘Cowman’ (table=ABC, action=READ) in jvm conf. add “-DHADOOP_USER_NAME=webuser”

Posted in HBase, Java | Leave a comment

[Apache] wordpress permalink 404 issue

edit site conf (vim /etc/apache2/sites-available/pr.site.org.conf) <VirtualHost pr.site.org:80> ServerName pr.site.org ServerAdmin webmaster@localhost DocumentRoot /var/www/pr.site.org # !– add this section <Directory /var/www/pr.site.org> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> # !– ErrorLog ${APACHE_LOG_DIR}/pr_error.log CustomLog ${APACHE_LOG_DIR}/pr_access.log combined </VirtualHost> … Continue reading

Posted in Apache, Ubuntu, WordPress | Leave a comment

[HBase] convert long value to bytes

Java code: public static void main(String[] args) { String stringValue = Bytes.toStringBinary(Bytes.toBytes(1532080782183l)); System.out.println(stringValue); Long longValue = Bytes.toLong(Bytes.toBytesBinary(stringValue)); System.out.println(longValue); } HBase shell command: hbase(main):056:0> Bytes.toStringBinary(Bytes.to_bytes(1532080782183)) => “\\x00\\x00\\x01d\\xB7!{g” hbase(main):057:0> Bytes.toLong(“\x00\x00\x01d\xB7!{g”.to_java_bytes) => 1532080782183

Posted in HBase, Java | Leave a comment

[Intellij] Checkstyle and Code Style

Checkstyle 介紹 根據定義好的規則對程式碼進行檢查,以確保程式碼的 Style 是一致的 (盡力…) Checkstyle GitHub 有提供兩種規則範例,後續套用的規則即是使用 “Google Checks” 進行修改 Sun Checks Google Checks 安裝 Checkstyle Preferences.. ➔ Plugins ➔ Browse repositories.. -> 搜尋 “CheckStyle” 安裝 “CheckStyle-IDEA” Checkstyle 規則文件說明 checkstyle/qmi_checks.xml 為 Checkstyle 主規則檔案 定義檢查的檔案格式、範圍 定義排除的規則檔案位置 (通常為 suppressions.xml) 定義檢查的項目,每一個項目可定義的屬性不固定,需檢視 … Continue reading

Posted in Intellij | Leave a comment

[Docker] The crontab is not work in docker

Source: docker容器内cron不执行 vim /etc/pam.d/crond # The PAM configuration file for the cron daemon # # No PAM authentication called, auth modules not needed account required pam_access.so account sufficient pam_access.so account include password-auth session required pam_loginuid.so session sufficient pam_loginuid.so session include … Continue reading

Posted in Docker, Linux | Leave a comment

[Git] edit commit message after push

Source: stackopenflow: Changing git commit message after push (given that no one pulled from remote) git comment –amend git push –force

Posted in Git | Leave a comment

[Python] fix error while loading shared libraries: libpython2.7.so.1.0

error log: /opt/rh/python27/root/usr/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory check libpython2.7.so.1.0 exist? find . -name ‘libpython2.7.so.1.0’ if the file was exist: edit the ldconfig config echo “/opt/rh/python27/root/usr/lib64” > /etc/ld.so.conf.d/python27.conf ldconfig … Continue reading

Posted in CentOS, Python | Leave a comment

[Git] find the file’s latest edited time

Source: stackoverflow: Find when a file was deleted in Git $ git log -1 — o-core/o-service/src/main/java/path/file.java commit 0d5ab0e5d9df7d7b5906ff8db169f43b760daea0 Author: cowman cowman@mitake.com.tw Date: Mon Dec 18 17:58:26 2017 +0800 remove file.java</code>

Posted in Git | Leave a comment