Skip to content

Instantly share code, notes, and snippets.

View BitProcessor's full-sized avatar

Maarten De Wispelaere BitProcessor

View GitHub Profile
! Remove empty spaces in grid
www.youtube.com##ytd-rich-grid-row,#contents.ytd-rich-grid-row:style(display: contents !important)
! Hide all videos containing the phrase "#shorts"
www.youtube.com##ytd-grid-video-renderer:has(#video-title:has-text(/(^| )#Shorts?( |$)/i))
www.youtube.com##ytd-rich-item-renderer:has(#video-title:has-text(/(^| )#Shorts?( |$)/i))
! Hide all videos with the shorts indicator on the thumbnail
www.youtube.com##ytd-grid-video-renderer:has([overlay-style="SHORTS"])
www.youtube.com##ytd-rich-item-renderer:has([overlay-style="SHORTS"])
@BitProcessor
BitProcessor / gh_actions_delete_workflow_runs
Created September 5, 2023 12:16
GitHub Actions: delete workflow runs
gh run list --json databaseId -q '.[].databaseId' |
xargs -IID gh api \
"repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/actions/runs/ID" \
-X DELETE
@BitProcessor
BitProcessor / loki_nginx_long_running.txt
Created December 28, 2021 11:57
Loki: parse NGINX ingress logs with pattern and count long running connections
count_over_time({namespace="ingress-nginx"}
| pattern `<remote_addr> - <remote_user> [<time_local>] "<request>" <status> <body_bytes_sent> "<http_referer>" "<http_user_agent>" <request_length> <request_time> [<proxy_upstream_name>] [<proxy_alternative_upstream_name>] <upstream_addr> <upstream_response_length> <upstream_response_time> <upstream_status> <req_id>`
| upstream_response_time > 120
| __error__="" [5m])
@BitProcessor
BitProcessor / config.json
Created March 22, 2021 09:57
.docker/config.json
{
"HttpHeaders" : {
"User-Agent" : "Docker-Client/19.03.13 (darwin)"
},
"credsStore": "osxkeychain",
"experimental" : "disabled",
"credHelpers": {
"748094632676.dkr.ecr.eu-west-1.amazonaws.com": "ecr-login"
}
}
@BitProcessor
BitProcessor / gist:19936d6abac0686f9e7457571a38c0bd
Created November 2, 2020 18:35
eksctl create iamidentitymapping (for system:masters)
eksctl create iamidentitymapping --arn arn:aws:iam::<account ID>:user/<IAM user> --group system:masters --cluster <cluster-name> --username <username>
@BitProcessor
BitProcessor / tunnelblick_skipWarningAboutDnsProblems
Created October 16, 2020 06:43
Stop Tunnelblick DNS nagging
defaults write net.tunnelblick.tunnelblick skipWarningAboutDnsProblems -bool yes
{
"series": [{
"metric": "my.metric.name",
"points": [[1583960307, 28]],
"type": "gauge",
"tags": ["tag1:value","tag2:value","tag3:value"]}
]
}
# with 1583960307 being the value outputed by date +%s
@BitProcessor
BitProcessor / get_ip.sh
Last active February 19, 2020 21:27
Get IP used by network adapter in use for default route
!#/usr/bin/env bash
ip a s $(ip r s | grep default | cut -f5 -d' ') | grep inet | grep -v inet6 | cut -f6 -d' ' | cut -f1 -d'/'
@BitProcessor
BitProcessor / docker_add_labels.sh
Created November 5, 2019 10:50
Docker: Add labels to an existing docker image
SOURCE_IMG=
DEST_IMG=
echo "FROM $SOURCE_IMG" | docker build \
--label Author="Supplystack NV <[email protected]>" \
--label org.label-schema.schema-version="1.0" \
--label org.label-schema.build-date="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-t "$DEST_IMG" -
@BitProcessor
BitProcessor / k8s_remove_inactive_replicasets
Last active October 19, 2019 11:42
K8S: Remove inactive replicates
# Running this command will not delete anything.
# Redirect output to a temporary file, view contents, run.
kubectl get --all-namespaces rs -o json|jq -r '.items[] | select(.spec.replicas | contains(0)) | "kubectl delete rs --namespace=\(.metadata.namespace) \(.metadata.name)"'