Skip to content

Instantly share code, notes, and snippets.

View andyshinn's full-sized avatar
🖥️
don't put computers in your mouth

Andy Shinn andyshinn

🖥️
don't put computers in your mouth
View GitHub Profile
@andyshinn
andyshinn / README.md
Created June 22, 2024 00:14 — forked from M0r13n/README.md
Logging with Loguru in Flask

This is a simple example of how to use loguru in your flask application

Just create a new InterceptHandler and add it to your app. Different settings should be configured in your config file, so that it is easy to change settings.

Logging is then as easy as:

from loguru import logger

logger.info("I am logging from loguru!")

from flask import Flask, request, send_file, jsonify
import hashlib
import requests
import json
from PIL import Image
from io import BytesIO
from geolite2 import geolite2
app = Flask(__name__)
import os
import yaml
from ansible.parsing.vault import VaultLib, VaultSecret
from ruamel.yaml import YAML
from ruamel.yaml.scalarstring import LiteralScalarString
def custom_literal_presenter(dumper, data):
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
@andyshinn
andyshinn / code.py
Created November 3, 2022 17:30
CircuitPython NeoPixel Matrix 16x16 Pumpkin
from time import sleep
import board
import neopixel
from adafruit_pixel_framebuf import PixelFramebuffer
from pumpkin import pumpkins_tileset_data, pumpkin_palette
pixel_pin = board.D10
pixel_width = 16
pixel_height = 16
# [include Macros.cfg] # You have to copy it /home/pi/klipper_config https://www.klipper3d.org/Config_Reference.html#include
# [include client_macros.cfg] # These macros are required for Fluidd to correctly function.
# This is a Klipper configuration for Qidi X-Max, with
# V4.6 motherboard. with the cooperation of Funkton and oaba200
# instruction https://github.com/KevinOConnor/klipper/blob/master/docs/Config_Reference.md
[mcu]
restart_method: command
serial: /dev/ttyS0
#pragma once
#include "wled.h"
//
// Inspired by the v1 usermods
// * rotary_encoder_change_brightness
// * rotary_encoder_change_effect
//
// v2 usermod that provides a rotary encoder-based UI.
resource "google_compute_network" "nat" {
project = var.gcp_project_id
name = "nat"
}
resource "google_compute_router" "nat" {
project = var.gcp_project_id
name = "nat"
network = google_compute_network.nat.self_link
}
@andyshinn
andyshinn / maybe_2020_is_year_of_the_linux_desktop?
Created March 4, 2020 21:17
Trying out Ubuntu Budgie as a desktop OS: First week notes
I built a HEDT Windows PC late 2019 and wanted to start using it as a development environment in addition to games. It's got a Threadripper 2950X, Nvidia 2080 Ti, 64 GB memory, and 2 x Samsung 970 Pro NVMe SSDs (one dedicated to Windows 10, one to Ubuntu). These are my notes after week one of installation and usage as a work environment (Python development, DevOps, remote administration, and hopefully some video / media transcoding and manipulation). I come from a Macbook Pro as my primary work / development machine.
• No LVM in normal ISO? Had to use alternative "netinstall" ISO...OK.
• Can't click dismiss on initial WiFi notification... dismiss button broken?
• Change time from 24 hour to AM/PM. Status bar shows AM/PM but desktop still shows 24 hour...
• Xorg Nvidia driver by default, terrible resolution. Use nvidia proprietary. Reboot.
• Looks good but refresh rate 60hz? Manually change to 144.
• Refresh rate changes back to 60 on logout and back to 144 on login... How to make system wide?
• SSH keys not
@andyshinn
andyshinn / README.md
Last active May 3, 2024 11:21
Terraform variables per-workspace
$ terraform workspace new staging   
Created and switched to workspace "staging"!

You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
@andyshinn
andyshinn / BYEQUICKSWITCHER.md
Last active July 16, 2019 15:37
Get rid of Slack Quick switch / Jump to widget

These instructions will help you get rid of the Slack quick-switcher on macOS. Slack 4.0.0 introduces a different packing mechanism which adds some steps. But both sets of steps will use the following JavaScript snippet:

document.addEventListener("DOMContentLoaded", function() {
  let customCustomCSS = `
  div.p-channel_sidebar__navigation_bar {
    display: none;
  }
  `