Skip to content

Instantly share code, notes, and snippets.

View mcclory's full-sized avatar
😎

Patrick McClory mcclory

😎
View GitHub Profile
@mcclory
mcclory / lshw
Created April 20, 2023 17:35
ansible community mysql bug report - extended info
openstack-01
description: Computer
product: AS -1124US-TNRP (To be filled by O.E.M.)
vendor: Supermicro
version: 0123456789
serial: <redacted>
width: 64 bits
capabilities: smbios-3.2.0 dmi-3.2.0 smp vsyscall32
configuration: boot=normal family=To be filled by O.E.M. sku=To be filled by O.E.M. uuid=8b641600-87fd-11eb-8000-3cecef5dbea8
*-core
@mcclory
mcclory / .gitignore
Last active March 8, 2021 17:27
Python + Poetry in serverless - A few things to make sure you have in your serverless.yml file
# Distribution / packaging
.Python
.DS_Store
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
@mcclory
mcclory / __README.md
Last active December 28, 2020 23:47
Mac Dev Install

How to use this thing

  • open a terminal
  • copy/paste the _runit.sh script into a file (chmod +x it and run it) or just run it line by line
#!/bin/bash
sudo apt update -y
sudo apt install python3-dev python3-pip
pip3 install ansible
---
# sudo apt install python3-pip
# sudo pip3 install ansible
# mkdir -p ~/.ansible/plugins/modules/
# curl https://raw.githubusercontent.com/jistr/ansible-gsetting/master/gsetting.py > ~/.ansible/plugins/modules/gsetting.py
# sudo ansible-playbook <name of this file>.yaml
- hosts: localhost
connection: local
become: yes
tasks:
@mcclory
mcclory / working.py
Last active June 21, 2020 22:01
Adafruit pwm servos
from adafruit_servokit import ServoKit
from time import sleep
kit = ServoKit(channels=16)
DOOR = 0
kit.servo[DOOR].actuation_range = 270
kit.servo[DOOR].set_pulse_width_range(1000,2500)
def open_door(open_angle=120, increment=10, pause_time=0.05):
@mcclory
mcclory / wp-backup.sh
Last active July 22, 2018 15:16
A simple Wordpress backup script... it's not perfect, but it'll get the job done for most basic setups.
#!/bin/bash
# MySQL database credentials
DB_USER="" # put your wordpres mysql user name here
DB_PASS='' # put your database password here
DB_NAME="" # put your mysql database name here
DB_HOST="" # put your mysql host here
# Base path for wordpress files
WWW_DIR="/var/www/html" # set this to the base path of your wordpress install
# Set the date format, filename and the directories where your backup files will be placed and which directory will be archived.
@mcclory
mcclory / mac-install.sh
Last active July 18, 2018 19:29
New workstation install scripts
# Step 1 - install xcode tools
# Xcode unattended install - https://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
xcode-select --install
# deal with the interactive windows to approve/accept license
# Step 2 - install homebrew
# Install homebrew - https://brew.sh/
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@mcclory
mcclory / linux-install.sh
Last active October 18, 2018 16:37
New Workstation setup
sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get install -y laptop-mode-tools
# docker-ce - https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" && \
sudo apt-get install -y docker-ce
@mcclory
mcclory / dli-power-snippet.py
Created August 3, 2017 14:56
Ubuntu MAAS dli.py power driver status edits
# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""DLI Power Driver."""
__all__ = []
import re
from time import sleep