Coding Spirit

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

If set runs-on as ubuntu-latest, user can use Github CLI tool gh to set secret in actions:

1
2
3
4
5
6
7
- name: Set ECR credentials
id: set-ecr-credentials
run: |
gh auth login --with-token <<< ${{ secrets.PA_TOKEN }}
gh secret set ECR_REGISTRY --body ${{ steps.login-ecr.outputs.registry }} --repo ${{ github.repository }}
gh secret set ECR_USERNAME --body ${{ steps.login-ecr.outputs.username }} --repo ${{ github.repository }}
gh secret set ECR_PASSWORD --body ${{ steps.login-ecr.outputs.password }} --repo ${{ github.repository }}

Using following command to delete all workflow runs on GitHub actions of a specific branch:

1
user=GH_USERNAME repo=REPO_NAME; gh api repos/$user/$repo/actions/runs \--paginate -q '.workflow_runs[] | select(.head_branch == "master") | "\(.id)"' | \xargs -n1 -I % gh api repos/$user/$repo/actions/runs/% -X DELETE

Replace GH_USERNAME and REPO_NAME with your parameters.

You need to install GitHub CLI tool gh first.

1
raspivid -o - -t 0 | cvlc -v stream:///dev/stdin --sout '#rtp{sdp=rtsp://:5554/}' :demux=h264

AWS doesn’t provide official AWS CLI V2 binary release for Raspberry Pi. To install V2 on Raspberry Pi, we have to install it from source:

1
2
3
4
git clone https://github.com/aws/aws-cli.git
cd aws-cli && git checkout v2
sudo pip3 install -r requirements.txt
sudo pip3 install . --prefix /usr/local

GNU linker provides an --wrap option which can help developer replace symbols easily.

Read more »

By creating 2 targets and set same OUTPUT_NAME for both targets:

1
2
3
4
5
6
7
8
9
10
11
add_library(v4l2capturer-shared SHARED ${V4L2CAPTURER_SRC})
target_include_directories(v4l2capturer-shared PRIVATE ${LIBV4L2_INCLUDE_DIRS})
target_include_directories(v4l2capturer-shared PUBLIC ${V4L2CAPTURER_INC})
set_target_properties(v4l2capturer-shared PROPERTIES OUTPUT_NAME v4l2capturer)
target_link_libraries(v4l2capturer-shared PRIVATE ${LIBV4L2_LIBRARIES})

add_library(v4l2capturer-static STATIC ${V4L2CAPTURER_SRC})
target_include_directories(v4l2capturer-static PRIVATE ${LIBV4L2_INCLUDE_DIRS})
target_include_directories(v4l2capturer-static PUBLIC ${V4L2CAPTURER_INC})
set_target_properties(v4l2capturer-static PROPERTIES OUTPUT_NAME v4l2capturer)
target_link_libraries(v4l2capturer-static PRIVATE ${LIBV4L2_LIBRARIES})
0%