Skip to content

Instantly share code, notes, and snippets.

Avatar

Doug Bridgens thisdougb

View GitHub Profile
@thisdougb
thisdougb / vaultconnect_test.go
Last active Dec 13, 2020
Golang HashiCorp Vault dependency testing
View vaultconnect_test.go
// my app datastore using a hashi corp vault backend
package hashicorpvault
import (
"fmt"
kv "github.com/hashicorp/vault-plugin-secrets-kv"
"github.com/hashicorp/vault/api"
vaulthttp "github.com/hashicorp/vault/http"
"github.com/hashicorp/vault/sdk/helper/logging"
@thisdougb
thisdougb / AppleMagicPower.sh
Last active Apr 26, 2020
Simple alert to let you know when the device battery is low.
View AppleMagicPower.sh
#!/usr/bin/env bash
#
# Pops up a window notification to let you know when your Magic devices are below THRESHOLD. OSX
# gives you a warning at about 2% battery (mouse and keyboard), which means you have to stop work
# when the battery dies. Threshold at 20% gives you a few days of power to fit charging in.
#
# eg:
# ---------------------------------------
# | |
# | Get a coffee and charge: |
@thisdougb
thisdougb / Zwift-to-CyclingAnalytics
Last active Mar 25, 2020
Javascript to inject clickable link to upload Zwift activities to Cycling Analytics.
View Zwift-to-CyclingAnalytics
/*
VERSION 2 : run this bookmarklet per activity.
Blog post here: https://far-oeuf.com/cycling/2020-03-25-zwift-to-cycling-analytics
General instructions for bookmarklets and CA here: https://www.cyclinganalytics.com/blog/2018/10/upload-rides-from-zwift
Though somethings not working with the generated code, so go here to actually create the bookmarklet code: https://bookmarklets.org/maker/
(remember to replace REPLACE_THIS_WITH_TOKEN with your token)
Go to your Zwift feed: https://zwift.com/feed
View Ansible random list choice in a loop
---
- hosts: localhost
vars:
mydomain: mytest.com
moons:
- moon
- deimos
- styx
@thisdougb
thisdougb / quick_dirty_add_vars.py
Last active Dec 23, 2017
adding section task vars to MindPointGroup/RHEL7-CIS (issue #26)
View quick_dirty_add_vars.py
#!/usr/bin/env python
import re
vars_array = []
tasks = []
this_task = []
with open("original_section1.yml", "r") as file:
@thisdougb
thisdougb / tower-restore
Last active Jul 12, 2017
restore code for Tower
View tower-restore
[root@ansible-tower ansible-tower-setup-3.1.4]# more restore.yml
---
- hosts: database
gather_facts: false
tasks:
- name: Temporarily grant createdb role
postgresql_user:
name: awx
role_attr_flags: CREATEDB
become: yes
View gist:6ec15236f4e76eb767c7cbbf44706916
[root@ansible-tower ansible-tower-setup-3.1.4]# more restore.yml
---
- hosts: database
gather_facts: false
tasks:
- name: Temporarily grant createdb role
postgresql_user:
name: awx
role_attr_flags: CREATEDB
become: yes