Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Author Archives: cowman.chiang
CSS: Center text (horizontally and vertically)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<html> <head> <meta charset="UTF-8"> <title>404 Error Page</title> <style> .parent{ width: 100%; height: 30%; margin-bottom: 50px; text-align: center; } .text-parent:before { content: ""; display: inline-block; height: 100%; vertical-align: middle; } </style> </head> <body> <div class="parent text-parent"> <h1> 404 </h1> <hr> <h3>此活動不存在</h3> </div> </body> </html> |
Ref.: iThome: 29. CSS 水平置中/ 垂直置中的方法
Mac OS X upgrade cURL with SSL support
┌─Cowman@CLOUD-42:~/Downloads/20160511 └──$ sh curl.sh guList curl: (1) Protocol “‘https” not supported or disabled in libcurl ┌─Cowman@CLOUD-42:~/Downloads/20160511 └──$ brew install curl –with-nghttp2 ==> Installing dependencies for curl: openssl, pkg-config, libev, libevent, jansson, boost, libxml2, spdylay, nghttp2 ….
Posted in Mac
Leave a comment
Delete snapshots older than 7 days
To avoid running out of disk space in our test environment, we developed a plan to regularly execute shell scripts to clean up unnecessary snapshots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#!/bin/bash week=`date --date='7 days ago' +'%Y%m%d'` echo "list_snapshots" | /home/webuser/hbase-1.2.9/bin/hbase shell | grep "pattern " | \ while read CMD; do filename=($CMD) # echo $filename date=`echo $filename | awk -F "_" '{print $2}'` # echo "${filename#*_}" # echo $date # echo ${date:0:8} if [ "${date:0:8}" -lt $week ] then echo "delete_snapshot '$filename'" | /home/webuser/hbase-1.2.9/bin/hbase shell fi done |
Posted in HBase, Shell Script
Comments Off on Delete snapshots older than 7 days
Continuously print the file content
Use the command ‘tail’ to print the file contents, starting from the beginning of the file and print new contents continuously.
1 2 |
tail +1f 'file' |
Posted in Linux
Comments Off on Continuously print the file content
HBase Client 2.5.5 in JDK 11
Because of the vulnerability scan results of the project, the JDK version must be upgraded from 8 to 11 to complete the repair. The original HBase Client version 1.2 we used was incompatible with JDK 11, so we had to … Continue reading
AES decrypt in postman
sample code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
var CryptoJS = require("crypto-js"); let secretKey = 'yourSecretKey'; function decrypt(aesStr, key) { return CryptoJS.AES.decrypt( aesStr, CryptoJS.enc.Utf8.parse(padding(key)), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 } ).toString(CryptoJS.enc.Utf8) } function padding(key) { return key.padEnd(32, '\0'); } //decrypt("encryptedData", secretKey) |
Here we choose AES-256 to encrypt / decrypt the secure information. When using AES, the length of the secretKey is important. The length of secretKey in AES-128 is 16 bits, and in AES-256 is 32 bits. And … Continue reading
Posted in JavaScript, Postman
Comments Off on AES decrypt in postman
[Java] Create CSV files with BOM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
public static final String UTF8_BOM = "\uFEFF"; public ByteArrayInputStream createFile(Object object) { try { CSV csv = (CSV) object; StringBuffer sb = new StringBuffer(); sb.append(UTF8_BOM); if (csv.getHeaderList() != null) { sb.append(StringUtils.join(csv.getHeaderList().toArray(new String[0]), ",")).append("\n"); } for (List<String> row : csv.getDataList()) { sb.append(StringUtils.join(row.toArray(new String[0]), ",")).append("\n"); } return new ByteArrayInputStream(sb.toString().getBytes("UTF-8")); } catch (Exception e) { return null; } } |
Posted in Java
Comments Off on [Java] Create CSV files with BOM
[Linux] pkill command
I don’t know what’s going on. But we can use command “pkill” to delete those abnormal processes.
1 2 |
sudo pkill -f pgrep |
Reference: stackoverflow: How to kill all processes with a given partial name?
Posted in Linux
Comments Off on [Linux] pkill command
[Java] Google authenticator
Reference: 1. Greddy’s Blogs: Google Authenticator實作 2. 菜鳥工程師 肉豬: Spring Boot 使用Google身分驗證器做TOTP驗證 Google Authenticator TOTP auth
[Java] Download file without saving
Source: CSDN: InputStream类available和read方法可能读取不到完整的流数据 stackoverflow: How to read a http file inmemory without saving on local drive?
1 2 3 4 5 6 7 8 9 10 11 |
private static InputStream download(String sourceURL) throws Exception { InputStream inputStream = new URL(sourceURL).openStream(); ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int n = 0; while (-1 != (n = inputStream.read(buffer))) { output.write(buffer, 0, n); } return new ByteArrayInputStream(output.toByteArray()); } |
Posted in Java
Comments Off on [Java] Download file without saving