Skip to content

Instantly share code, notes, and snippets.

View davidthewatson's full-sized avatar

david watson davidthewatson

View GitHub Profile
@davidthewatson
davidthewatson / gist:a778a99fa639c78bfef871dbd53ef076
Created February 3, 2024 00:47
bluetoothctl commands for pairing logitech MK850 Keyboard on linux
bluetoothctl
power off
power on
agent KeyboardOnly
default-agent
pairable on
scan on
pair <mac address>
## the passkey will be printed, enter it on your keyboard ##
trust <mac address>
#!/bin/bash
# get username and password
echo "Username?"
read UNAME
echo "Password?"
read UPASS
echo "This will delete ever repo in your dockerhub. Ctrl-C to end."
read
set -e
@davidthewatson
davidthewatson / default-config-postgres.sql
Created January 9, 2020 16:21 — forked from paydro/default-config-postgres.sql
A base setup for new self-managed postgres databases. See related guide (https://tightlycoupled.io/my-goto-postgres-configuration-for-web-services/). Also, please make sure to change all the passwords from `secret` to something suitable. !! Update !! see this gist for a config that works for self-managed and RDS databases: https://gist.github.co…
CREATE ROLE owner LOGIN ENCRYPTED PASSWORD 'secret' CONNECTION LIMIT 3;
ALTER ROLE owner SET statement_timeout = 20000;
ALTER ROLE owner SET lock_timeout = 3000;
ALTER ROLE owner SET idle_in_transaction_session_timeout = 3000; -- v9.6+
CREATE ROLE readwrite_users NOLOGIN;
CREATE ROLE readonly_users NOLOGIN;
CREATE DATABASE exampledb WITH OWNER owner ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
@davidthewatson
davidthewatson / install_minikube_kvm2_arch.sh
Last active March 22, 2019 11:16
Install minikube using kvm2 on arch based linux distros such as manjaro
sudo pacman -Sy libvirt qemu-headless ebtables dnsmasq
sudo systemctl enable libvirtd.service
sudo systemctl enable virtlogd.service
sudo pacman -Sy docker-machine
yaourt -Sy minikube-bin kubectl-bin
yaourt -Sy docker-machine-driver-kvm2
# start sans proxy
minikube start --vm-driver kvm2
# start with proxy
minikube start --vm-driver kvm2 --docker-env http_proxy=http://proxy.cat.com:80 --docker-env https_proxy=http://proxy.cat.com:80 --docker-env no_proxy="localhost,127.0.0.1,192.168.39.1/24,10.96.0.0/12"
@davidthewatson
davidthewatson / LXD_SSH_KEY.md
Created March 7, 2019 16:21 — forked from jeanlouisferey/LXD_SSH_KEY.md
How to create a LXD Container with your ssh key in it (and with ssh server in the container)
https://github.com/juju-solutions/bundle-canonical-kubernetes/wiki/Proxy-configuration
@davidthewatson
davidthewatson / k8s_on_ubuntu_18.10_with_lxd.md
Last active January 15, 2019 21:28
kubernetes on ubuntu 18.10 with lxd

Kubernetes on Ubuntu 18.10 with LXD

  1. install Ubuntu 18.10

  2. upgrade

  3. reboot

     snap install lxd
     sudo lxd init
    

take all of the defaults EXCEPT IPV6 should be set to none since the conjure-up K8s install can only use lxdbr0 with IPv4 only

@davidthewatson
davidthewatson / cities.json
Created June 12, 2018 19:05 — forked from Miserlou/cities.json
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@davidthewatson
davidthewatson / list_pip_dependencies.sh
Last active November 13, 2017 22:26
For a given python repo on github, output a list of dependencies for a virtualenv, then read that list and generate a CSV describing licenses
pip list | xargs pip show >output.txt
@davidthewatson
davidthewatson / halloween_lightify.py
Created November 2, 2017 02:11
Flash the house lights like an insane asylum for halloween
from lightify import Lightify
lightify = Lightify('192.168.1.10')
lightify.update_all_light_status()
lights = lightify.lights()
ls = {light.name(): light for light in lights.values()}
def rainbow():
r, g, b = 255, 0, 0
for g in range(256):
yield r, g, b