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
import os
from discord.ext import commands
from discord import Intents
from bridger.log import logger
try:
DISCORD_BOT_TOKEN = os.getenv("DISCORD_BOT_TOKEN")
DISCORD_BOT_OWNER_ID = int(os.getenv("DISCORD_BOT_OWNER_ID"))
esphome:
name: chargewell
on_boot:
then:
- switch.turn_on: backlight_switch
esp32:
board: adafruit_feather_esp32_v2
logger:

VESC macOS Universal Build

Some parts referenced from https://www.downtowndougbrown.com/2023/08/how-to-create-a-qt-5-arm-intel-universal-binary-for-mac/

I will be working on a Mac Studio M2 with macOS 14.5. But these instructions should work on any Mac with macOS 12.0 or later. I will also be downloading and building in $HOME/qt but feel free to change VESCBUILDBASE to another folder you with to use.

The resulting build will be in /opt/external/qt-5.15.14 so change the -prefix option if you wish to change that. Also feel free to change -j8 to a higher number if you have more cores available to speed up the build.

Open up Terminal and let's get started!

vesc_tool on  master via C v15.0.0-clang
❯ make
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic mainwindow.ui -o build/macos/obj/ui_mainwindow.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic boardsetupwindow.ui -o build/macos/obj/ui_boardsetupwindow.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic parametereditor.ui -o build/macos/obj/ui_parametereditor.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic preferences.ui -o build/macos/obj/ui_preferences.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic pages/pageapppas.ui -o build/macos/obj/ui_pageapppas.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic pages/pagebms.ui -o build/macos/obj/ui_pagebms.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic pages/pagecananalyzer.ui -o build/macos/obj/ui_pagecananalyzer.h
/opt/homebrew/Cellar/qt@5/5.15.13_1/bin/uic pages/pageconnection.ui -o build/macos/obj/ui_pageconnection.h
@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.