Default keyboard shortcuts for Ghostty terminal emulator. Platform-specific differences are noted where applicable.
| Action | Windows/Linux | macOS |
|---|---|---|
| New window | Ctrl+Shift+N | Cmd+N |
| Close window | Alt+F4 | Cmd+Shift+W |
I was trying to get some CP code to talk to Processing over a serial port interface. Of course, the CP REPL is normally available on whatever serial port the board mounts by default. This is a little complicated, because although you can use something like print from the REPL (or code.py) to print a value to the console, sys.stdin and sys.stdout are text-based streams, which may not be what you want. And you'll get REPL noise to boot. Not ideal.
This is where usb_cdc comes in. It's a handy library for managing the USB CDC (serial) on most CircuitPython boards. First, usb_cdc can be used to control how many serial ports CP will provide at startup. You can modify boot.py to make this work:
import usb_cdc
usb_cdc.enable(console=True, data=False)
| -- Utility functions for matrix.dot | |
| local function dotScalar1dVector(scalar, v1) | |
| local outputVector = {} | |
| for i = 1, #v1, 1 do | |
| outputVector[i] = v1[i] * scalar | |
| end | |
| return matrix(outputVector) | |
| end | |
| local function dotScalar2dVector(scalar, v1) |
| Beginner-friendly GDScript 1 to GDScript 2 Conversion Guide | |
| First and foremost, this should not be considered a replacement for the official migration guide, | |
| found at https://docs.godotengine.org/en/latest/tutorials/migrating/upgrading_to_godot_4.html! | |
| Instead, this document is intended to be a friendly guide to helping you upgrade your projects from | |
| GDScript 1 to 2. To do this, I'm going to list the most common conversions I've run into while upgrading | |
| a few of my games and tools. This document is written as of the first release candidate version of Godot 4.0. | |
| The first thing to do when converting a project (no need if you're starting from new) is to either have your | |
| project in source control, or make a duplicate of your entire project's folder and rename it. This will |
| ## For a beginner-friendly version of the following (more advanced users likely will get better use of the below, | |
| ## if you're just starting out...), see this new gist: | |
| ## https://gist.github.com/WolfgangSenff/0a9c1d800db42a9a9441b2d0288ed0fd | |
| This document represents the beginning of an upgrade or migration document for GDScript 2.0 and Godot 4.0. I'm focusing on 2D | |
| at the moment as I'm upgrading a 2D game, but will hopefully have more to add for 3D afterward. | |
| ## If you want more content like this, please help fund my cat's medical bills at https://ko-fi.com/kyleszklenski - thank you very much! On to the migration guide. |
| import requests | |
| from tqdm import tqdm | |
| def download(url: str, fname: str, chunk_size=1024): | |
| resp = requests.get(url, stream=True) | |
| total = int(resp.headers.get('content-length', 0)) | |
| with open(fname, 'wb') as file, tqdm( | |
| desc=fname, | |
| total=total, |
| #!/bin/bash | |
| # This is a quick installer | |
| # script I made to build and install the latest version of | |
| # fish on my Raspberry Pi. | |
| # | |
| # Use at your own risk as I have made no effort to make | |
| # this install safe! | |
| set -e |
| "workbench.colorCustomizations": { | |
| // Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast. | |
| "contrastActiveBorder": "", | |
| "contrastBorder": "", | |
| // Base Colors | |
| "focusBorder": "", | |
| "foreground": "", | |
| "widget.shadow": "", | |
| "selection.background": "", | |
| "descriptionForeground": "", |
| from PIL import Image | |
| from pathlib import Path | |
| import random | |
| def gray_value(r, g, b): | |
| return 0.2989 * r + 0.5870 * g + 0.1140 * b | |
| def filter_2x2_bayer(image_file, threshold): |
| from ctypes import windll | |
| from ctypes import byref as ctypes_byref | |
| from ctypes.wintypes import MSG as wintypes_MSG | |
| import win32con | |
| class GlobalHotKeys(object): | |
| key_mapping = [] | |
| user32 = windll.user32 |