$ mkdir /opt/docker && cd /opt/docker
$ cat > docker-compose.yml <<'EOF'
version: '3.3'
services:
prometheus:
image: prom/prometheus
container_name: prometheus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This script will tell you what Docker container is tied to which vethXXXXXXXX interface on the host | |
| # All other "solutions" to this problem that I found require you to exec into the container | |
| #!/bin/bash | |
| { echo -e "CONTAINER_NAME\tPID\tINTERFACE" | |
| docker ps --format '{{.Names}}' | while read cname; do | |
| PID="$(docker inspect --format="{{.State.Pid}}" "${cname}")" | |
| INTERFACE="$(ip link show | grep -P "^$(nsenter -t "${PID}" -n ip link show eth0 | grep -oP '(?<=@if)[^:]+')(?=:)" | grep -oP 'veth[^@]+')" | |
| echo -e "${cname}\t${PID}\t${INTERFACE}" | |
| done } | column -t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| function matrixMessage { | |
| local INPUTMSG=$1 | |
| local MATRIX_SERVERURL="matrix.server.com" #dont add http(s) | |
| local MATRIX_ROOMID="!xXxXxXxXxXxX" #Format: !XxXxXxXxXxXxXx | |
| local MATRIX_TXNID="$(date +%s)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| function matrixMessage { | |
| local INPUTMSG=$1 | |
| local MATRIX_SERVERURL="matrix.server.com" #dont add http(s) | |
| local MATRIX_ROOMID="!xXxXxXxXxXxX" #Format: !XxXxXxXxXxXxXx | |
| local MATRIX_TXNID="$(date +%s)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| github_username='YourUsernameHere' | |
| github_pat='YourGitHubPATHere' | |
| curl -s -u "${github_username}:${github_pat}" 'https://api.github.com/user/repos?per_page=100' | grep -oP '(?<=clone_url\":[ ]\")[^(\",)]+' | sed "s|https://|https://${github_username}:${github_pat}@|" | while read repo; do | |
| reponame=$(grep -oP '(?<=\/)[^\/]+$' <<< $repo | sed 's/.git//') | |
| if [ -d $reponame ]; then | |
| echo "$reponame exists. Pulling latest changes..." | |
| cd "$reponame" | |
| git reset --hard | |
| git pull --ff-only | |
| cd - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -s 'https://api.github.com/users/AndrewPaglusch/gists' | grep -oP '(?<=raw_url\":[ ]\")[^(\",)]+' | while read i; do filename=$(grep -oP '(?<=\/)[^\/]+$' <<< $i); echo "Downloading $filename..."; curl -Lso "$filename" "$i"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'net/http' | |
| require 'openssl' | |
| require 'json' | |
| def send_matrix(server, room_id, api_key, message) | |
| uri = URI("https://#{server}/_matrix/client/r0/rooms/#{room_id}:#{server}/send/m.room.message/#{Time.now.to_i}?access_token=#{api_key}") | |
| req = Net::HTTP::Put.new(uri) | |
| req.body = {"msgtype" => "m.text", "body" => message}.to_json | |
| req['Content-Type'] = 'application/json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ################################################################################## | |
| # MIT License # | |
| # # | |
| # Copyright (c) 2021 Andrew Paglusch # | |
| # # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy # | |
| # of this software and associated documentation files (the "Software"), to deal # | |
| # in the Software without restriction, including without limitation the rights # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/bash | |
| export CF_API_KEY='xXxXxXxXxXxXxXxXxXxXxXxX' | |
| export CF_API_EMAIL='user@domain.com' | |
| curl -sX GET "https://api.cloudflare.com/client/v4/zones" -H "X-Auth-Email: ${CF_API_EMAIL}" -H "X-Auth-Key: ${CF_API_KEY}" -H "Content-Type: application/json" | grep -oP '(?<=","name":")[^"]+(?=","status":")' | while read i; do | |
| echo "Backing up zone \"${i}\"..." | |
| docker run --rm -e CF_API_KEY="$CF_API_KEY" -e CF_API_EMAIL="$CF_API_EMAIL" lfaoro/flares "${i}" > ./"${i}.zone" | |
| done | |
| echo "Done" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ################################################################################## | |
| # MIT License # | |
| # # | |
| # Copyright (c) 2021 Andrew Paglusch # | |
| # # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy # | |
| # of this software and associated documentation files (the "Software"), to deal # | |
| # in the Software without restriction, including without limitation the rights # |
NewerOlder