Skip to content

Instantly share code, notes, and snippets.

View crigertg's full-sized avatar

Claus-Theodor Riegg crigertg

View GitHub Profile
@crigertg
crigertg / toggle_headset.sh
Last active September 28, 2023 09:21
Use this script to automatically connect to a bluetooth headset and switch audio profiles.
#!/bin/bash
# Use this script to automatically connect to a bluetooth headset and switch audio profiles.
# By default the script toggles the headset connection on/off and selects the handsfree profile
# when a connection is established.
# There is the possibility to switch to the ALT_MODE which ensures a connection and
# when executed again it switches between the a2dp profile for music and handsfree for using the microphone.
# The MAC address of your Bluetooth headset
# Use `bluetoothctl devices` to list your devices
@crigertg
crigertg / delete_gitlab_merge_requests.sh
Last active February 14, 2023 10:26
In case many merge requests in a gitlab group have to be deleted according to the title this snippet can be used
#!/bin/bash
PRIVATE_TOKEN=$1
GROUP_ID=$2
TITLE_REGEX=$3
MR_STATUS=${4:-opened}
PAGE_SIZE=${5:-100}
for MR in $(curl -s --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" \
"https://gitlab.com/api/v4/groups/$GrOUP_ID/merge_requests?state=$MR_STATUS&per_page=$PAGE_SIZE" \
@crigertg
crigertg / gitlab_container_expiry.sh
Last active December 13, 2022 14:43
Create container expiration policy for all gitlab repos in a group
#!/bin/bash
TOKEN=<your_gitlab_token>
GITLAB_URL=https://gitlab.com
GROUP_ID=<your_group_id>
SETTINGS=$(cat <<EOF
{
"container_expiration_policy_attributes": {
"cadence": "1d",