Skip to content

Instantly share code, notes, and snippets.

Using the saml2aws utility, you can get a set of temporary AWS credentials that you can export to your docker container.
Use this command to put those credentials into a local environment file for docker:
$ saml2aws exec env | egrep 'AWS_(ACC|SECR|SES)' > env.file
Running command as: arn:aws:sts::123456789012:assumed-role/AWS-MyRole/[email protected]
You should now see AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN inside of env.file
Now start your container with the --env-file option, using the env.file you just created.
Using the saml2aws utility, you can get a set of temporary AWS credentials that you can export to your docker container.
Use this command to put those credentials into a local environment file for docker:
$ saml2aws exec env | egrep 'AWS_(ACC|SECR|SES)' > env.file
Running command as: arn:aws:sts::123456789012:assumed-role/AWS-MyRole/[email protected]
You should now see AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN inside of env.file
Now start your container with the --env-file option, using the env.file you just created.
# $ cat docker-compose.yml
version: '2'
services:
unifi:
image: ryansch/unifi-rpi:latest
container_name: unifi
restart: always
network_mode: host
volumes:
# Unifi v5.0.7 creates all of these directories (some remain empty)
version: "3"
# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
ports:
@shmick
shmick / 2019-12-17-scans
Created December 17, 2019 14:31
Channel report
Timestamp RF Strnght Quality Symbol Virtual Name
------------------------------------------------------------------------
2019-12-16 00:04 41 100 100 100 41.1 CIII
2019-12-16 01:05 41 100 100 100 41.1 CIII
2019-12-16 02:05 41 100 100 100 41.1 CIII
2019-12-16 03:05 41 100 100 100 41.1 CIII
2019-12-16 04:05 41 100 100 100 41.1 CIII
2019-12-16 05:05 41 100 100 100 41.1 CIII
2019-12-16 06:05 41 100 100 100 41.1 CIII
2019-12-16 07:04 41 100 100 100 41.1 CIII
#!/bin/bash
loblaws_10909() {
curl -m10 -s https://www.loblaws.ca/api/pickup-locations/1208/time-slots \
-H 'Site-Banner: loblaw' |
jq -e -r '.timeSlots[] | select(.available!=false)'
}
loblaws_high_tech() {
curl -m10 -s https://www.loblaws.ca/api/pickup-locations/1028/time-slots \
@shmick
shmick / ssh-clean
Last active July 7, 2022 14:03
A quick and dirty script to kill off stale ssh sessions on an asus router
#!/bin/sh
# add to cron to run every 20 minutes
# cru a ssh-clean "1,21,41 * * * * /jffs/cron/ssh-clean"
# remove cron
# cru d ssh-clean
netstat -p | grep ":ssh.*192.168.118.10:.*ESTABLISHED" | awk '{print $7}' | awk -F'/' '{print "kill", $1}' | sh
@shmick
shmick / ppp0_stats.sh
Last active February 11, 2024 21:43
Send UXG Lite ppp0 stats to Home Assistant
#!/bin/bash
# Using some hints from https://community.home-assistant.io/t/convert-webhook-into-multiple-temp-sensors/573335/2
# Get Receive and Transmit bytes for ppp0 interface
if read data_received data_sent < <(awk '/ppp0:/{print $2, $10}' /proc/net/dev); then
# Validate that data_received and data_sent are numbers
if [[ ! "$data_received" =~ ^[0-9]+$ ]] || [[ ! "$data_sent" =~ ^[0-9]+$ ]]; then
echo "Error: Received invalid data. Expected numeric values for data_received and data_sent." >&2
exit 1
@shmick
shmick / ppp0_stats.yaml
Created February 11, 2024 19:13
The automation yaml for ppp0 stats
alias: UXG ppp0 stats
description: UXG ppp0 stats
trigger:
- platform: webhook
allowed_methods:
- POST
local_only: true
webhook_id: "uxg_ppp0_stats"
condition: []
action:
@shmick
shmick / ppp0_template_sensors.yaml
Created February 11, 2024 19:14
Template sensors for ppp0 stats
- trigger:
- platform: event
event_type: set_ppp0_data_received
sensor:
- name: UXG ppp0 Data Received
unique_id: uxg_ppp0_data_received
state: "{{ trigger.event.data.state }}"
- trigger:
- platform: event