Skip to content

Instantly share code, notes, and snippets.

@richard-scott
richard-scott / send_email.py
Created May 17, 2021 14:38 — forked from drorata/send_email.py
Minimal example of sending a JSON over email
import json
# Import smtplib for the actual sending function
import smtplib
# Import the email modules we'll need
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from datetime import datetime
def send_email(data):
@richard-scott
richard-scott / hass_influx_drop_mesurments.sh
Created June 25, 2020 14:58 — forked from artkrz/hass_influx_drop_mesurments.sh
Remove measurements from HASS InfluxDB
#!/bin/bash
host=localhost
db='home_assistant'
measurements=$1
measurements=($(influx --host $host --execute 'show measurements' --database=$db | grep "$1"))
if (( ${#measurements[@]} ))
then
@richard-scott
richard-scott / ansible_kms_encrypt_decrypt.md
Created March 30, 2020 15:14 — forked from darahayes/ansible_kms_encrypt_decrypt.md
KMS Encrypt and Decrypt filters in Ansible

KMS Encrypt and Decrypt Filters for Ansible

This Gist shows how you can encrypt/decrypt variables with KMS during your Ansible playbook execution. While google searching I couldn't find anything useful on the subject.

Let's say your project has a folder of playbooks called plays.

In that folder, create a folder called filter_plugins and insert kms_filters.py (included in this gist)

@richard-scott
richard-scott / k8s-svc-annotations.md
Created October 15, 2019 11:06 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@richard-scott
richard-scott / GetAllWifiPasswords.ps1
Created October 4, 2019 16:05 — forked from Saturate/GetAllWifiPasswords.ps1
PowerShell Wifi Script
# Run this script as an Admin user and get a list of all WiFi passwords.
$listProfiles = netsh wlan show profiles | Select-String -Pattern "All User Profile" | %{ ($_ -split ":")[-1].Trim() };
$listProfiles | foreach {
$profileInfo = netsh wlan show profiles name=$_ key="clear";
$SSID = $profileInfo | Select-String -Pattern "SSID Name" | %{ ($_ -split ":")[-1].Trim() };
$Key = $profileInfo | Select-String -Pattern "Key Content" | %{ ($_ -split ":")[-1].Trim() };
[PSCustomObject]@{
WifiProfileName = $SSID;
Password = $Key
}
@richard-scott
richard-scott / linux_fusion360.md
Created October 1, 2019 14:21 — forked from probonopd/linux_fusion360.md
Autodesk Fusion 360 in the Linux Browser

Autodesk Fusion 360 on Linux

In the Web Browser

Ubuntu, Fedora, openSUSE, CentOS, SUSE Linux Enterprise, Debian,... users can finally use Autodesk Fusion 360 in the Linux Browser now.

https://myhub.autodesk360.com

On Chromium 55.0.2843.0 I get NET::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED.

@richard-scott
richard-scott / play.yml
Created October 1, 2019 12:57 — forked from halberom/play.yml
ansible - example of dynamic even/odd groups
# requirement
# given 2 groups (A and B), target 50% of each for code deploy
- hosts: localhost
tasks:
# this might need to be group_by or add_host
- set_fact:
even: "{{ groups['groupA'][::2] | union(groups['groupB'][::2] }}"
odd: "{{ groups['groupA'][1::2] | union(groups['groupB'][1::2] }}"
@richard-scott
richard-scott / git-io-custom-url.md
Created September 12, 2019 09:01 — forked from dikiaap/git-io-custom-url.md
git.io custom URL

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
@richard-scott
richard-scott / wsgi_bjoern.py
Created August 1, 2019 10:41 — forked from gcavalcante8808/wsgi_bjoern.py
Bjoern Django Final
import bjoern
import os, signal
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
app = get_wsgi_application()
NUM_WORKERS = 8
@richard-scott
richard-scott / hassio_ubuntu_install_commands.sh
Created July 30, 2019 06:24 — forked from frenck/hassio_ubuntu_install_commands.sh
Simple install command for installing Hass.io on a Generic Ubuntu/Debian machine
sudo -i
add-apt-repository universe
apt-get update
apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat software-properties-common
curl -sSL https://get.docker.com | sh
curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s