Coding Spirit

一位程序员,比较帅的那种

Jenkins is running on port 8080 by default, thus user need to manually add :8080 when access Jenkins. If we make it running on port 80(default http port), user will no longer need to type port number manually.

Read more »

CMake will try to check compiler is working or not if project language was set to C/CXX. However, sometimes we just want to skip this test…

Read more »

With OAuth2 Token Authentication

1
curl -H "Authorization: token <OAUTH-TOKEN>" https://api.github.com

Create A Release And Add An Artifact

1
2
3
4
5
6
7
8
9
10
11
12
# Create a new release and get upload url
upload_url=$(curl -s -H "Authorization: token $TOKEN" \
-d '{"tag_name":"'"$ARTIFACTS_BASE_NAME"'", "name":"'"$ARTIFACTS_BASE_NAME"'", "body":"'"$ARTIFACTS_BASE_NAME"'", "target_commitish":"'"$TARGET_BRANCH"'"}' \
"https://api.github.com/repos/$REPO/$TARGET_BRANCH" | jq -r '.upload_url')

upload_url="${upload_url%\{*}"

# Upload a tarball
curl -s -H "Authorization: token $TOKEN" \
-H "Content-Type: application/x-gzip" \
--data-binary @$ARTIFACTS_BASE_NAME.tar.gz \
"$upload_url?name=$ARTIFACTS_BASE_NAME.tar.gz&label=$ARTIFACTS_BASE_NAME.tar.gz"

Yesterday successfully cross compiled curl with mbedTLS, but there was an error when trying to access a https link:

1
SSL certificate problem: unable to get local issuer certificate

To fix it, download CA certificate to local machine and export environment variable CURL_CA_BUNDLE:

1
2
wget https://curl.haxx.se/ca/cacert.pem
export CURL_CA_BUNDLE=<path of cacert.pem>

When I was in university, I had developed a BLE based UAV controller based on an open source Android BLE library. The library itself is quite easy to use but I decided to develop an Android BLE app with native Android BLE API, which can connect and communicate with BLE GATT devices.

Read more »

“Swipe down/Pull down to refresh” is a widely used feature in various kinds of apps. Let’s see how can we do that via SwipeRefreshLayout in AndroidX.

Read more »

When we try to access a serial port device(i.e /dev/ttyUSB0) as a normal user, a Permission denied error will occur. Let’s take a look at permissions for those serial port devices:

1
2
ll /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 6月 22 19:28 /dev/ttyUSB0

As we can see, except root user, dialout group also has permissions to those serial port tty devices. Hence, to allow normal user access serial port devices, adding normal user to dialout group will suffice:

1
sudo usermod -aG dialout $USER
0%