Skip to content

Instantly share code, notes, and snippets.

View buddylindsey's full-sized avatar
🚜
Homesteading

Buddy Lindsey, Jr. buddylindsey

🚜
Homesteading
View GitHub Profile
kubessh() {
local namespace=""
local pod=""
local init_container=""
local main_container=""
while getopts ":n:" opt; do
case $opt in
n)
namespace="$OPTARG"
@buddylindsey
buddylindsey / migrate_user.py
Created May 11, 2022 13:31
Django: Migrate all of a Users FK and OneToOne fields to another user
from typing import Any, List, Type, Union
from django.apps import apps
from django.db import transaction
from django.db.models import Model
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey, ForeignObjectRel, OneToOneField
class MigrateUser:
def __init__(self, _from_id: int, to_id: int) -> None:
@buddylindsey
buddylindsey / mp2.5.c
Created September 18, 2021 22:11
Rough PM 2.5 Rework of code with AQI Calculation for use in displaying lights.
#include "Adafruit_PM25AQI.h"
Adafruit_PM25AQI aqi = Adafruit_PM25AQI();
int redLed=9;
int yellowLed=10;
int greenLed=11;
float LOWER_BOUND=100.00;
float UPPER_BOUND=151.00;
@buddylindsey
buddylindsey / sqsclient.py
Last active October 20, 2020 00:03
SQS Client
class SQSClient:
def __init__(self, queue):
self.delete = False
self.client = boto3.client("sqs")
self.url = self.get_queue(queue)
self.receipt_handles = None
def __enter__(self):
return self
@buddylindsey
buddylindsey / launch.json
Created May 21, 2020 19:01
VS Code Debug with Django add the following to your .vscode
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django Shell",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": ["shell_plus"],
"django": true
@buddylindsey
buddylindsey / fishbowl-overview.md
Last active April 9, 2020 20:35
fishbowl-overview
const pdf = require("pdfjs");
const fs = require("fs");
const run = async () => {
const doc = new pdf.Document();
doc.pipe(fs.createWriteStream("./test.pdf"));
doc.text("Hello World");

boto3 does not have a built-in sync ability, but awscli does. Since awscli is just a python package I figured there had to be a way to use the sync command. Here is how.

pip install boto3
pip install awscli

Run the code in the sync.py file.

@buddylindsey
buddylindsey / config
Created November 18, 2019 16:18
AWS cli Profile Config
[profile myprofile]
region=us-east-2
[profile amplify-test]
region=us-east-1
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set-option -g default-shell /bin/zsh
# so you don't end up with window numbers like: 0 1 4 5 6