Skip to content

Instantly share code, notes, and snippets.

View ChrisCrossCrash's full-sized avatar
🔥
This is fine!

Christopher Kumm ChrisCrossCrash

🔥
This is fine!
View GitHub Profile
@ChrisCrossCrash
ChrisCrossCrash / mqtt-client.ino
Created May 6, 2024 03:02
Connects a wifi-enabled Arduino to an MQTT broker without TLS
/*
* This sketch connects to a WiFi network and sends a message to an MQTT broker.
*/
#include <WiFi.h>
#include <ArduinoMqttClient.h>
// TODO: Replace these with your WiFi credentials
const char ssid[] = "myWifiSsid";
const char pass[] = "myWifiPassword";

Compiling Rust for Arduino on WSL

Follow this guide with the following modifications:

  • You'll need to manually share the Windows USB ports with WSL using usbipd-win.
  • The guide tells how to list the USB devices with lsusb, but it doesn't show how to get the name of the device file that you'll need when setting RAVEDUDE_PORT. To get that, use dmesg | grep tty:
    ck@ck-win-pro:~/tuts/rust-x-arduino (main)
    $ dmesg | grep tty
    [ 1974.578111] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
    
@ChrisCrossCrash
ChrisCrossCrash / docker-mongo.md
Created April 3, 2024 02:18
Quick MongoDB Docker setup

To quickly start a MongoDB container, run:

docker run --rm -d -p 27017:27017 --name my-mongo mongo

If you want to open a shell in the MongoDB container run:

docker exec -it my-mongo mongosh
@ChrisCrossCrash
ChrisCrossCrash / TwoPanelLayout.tsx
Last active February 2, 2024 22:01
A two-panel layout that only displays one panel at a time.
import React from 'react'
type TwoPanelShiftLayoutProps = {
panelLeft: React.ReactNode
panelRight: React.ReactNode
isShifted?: boolean
className?: string
style?: React.CSSProperties
}
@ChrisCrossCrash
ChrisCrossCrash / TriPanelShiftLayout.tsx
Created January 28, 2024 20:02
A three-panel layout that only displays two panels at once.
import React from 'react'
type TriPanelShiftLayoutProps = {
panelStart: React.ReactNode
panelCenter: React.ReactNode
panelEnd: React.ReactNode
isShifted?: boolean
className?: string
style?: React.CSSProperties
}
@ChrisCrossCrash
ChrisCrossCrash / chriskumm-pgp-public.asc
Last active December 8, 2023 23:53
My PGP public key. Use this to securely encrypt files before sending them to me.
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGVzTzIBEADUTfwrqkX8MMUfbVYUmG0KRtkuhPh7HHL86Tg7hg6pzrSg5CtE
hs/YzzXciimwJzGOXcLX/IZB7mT9XoUAvBJ93Z8VVU7d0jE35QFkEwq2ZwzRENWu
75oBciOF4isNcMPDU3NZTKKP2xV2tlrY/mX0wq4Miuarl6l2BeraTp0VyhkBhgJy
GdoUugN09zuIQeveQGEaAkYa5SfId+EQ19jwtAxQNGMlg/DGfFkpGTMsGg91rUSi
LgDj92NTqVUiBcxFuitCsJGJcXEdj3lJwb4x3v8AnEl1IATElfZMdPnm8k35yAD1
ZkiGFj44YhtAefhSlt267hT+h9OtpQ0+GC/BRsl22FLoXxBdx41ekIKqncQPA1WM
rj7ZezRpe3Jqzl33XJDR+X+0RYqRCP6EzN6iGYfblFSQUnqoj8shvNEuQG0sdHZ3
dVkuJN5R5Zqxwy4imrBZi3ox/poavMnbqyKrABXZkm2Y8t80fNEMd15qI9HeUUYi
@ChrisCrossCrash
ChrisCrossCrash / create-component.sh
Created November 6, 2023 18:25
A bash script to scaffold a new React component with associated SCSS module and TypeScript file.
#!/bin/bash
# This script creates a new React component with the specified name.
# It sets up a directory for the component, a SCSS module with a base class,
# and a TypeScript file for the component that imports the SCSS module.
# The created files follow a predefined template structure.
# The script must be run with one argument: the name of the component.
# Usage example: ./create-component.sh MyComponent
@ChrisCrossCrash
ChrisCrossCrash / BlurFramedImage.tsx
Last active October 3, 2023 16:29
Frames an image by having the `object-fit: contain;` foreground image and `object-fit: cover;` on the blurred background image.
import Image from 'next/image'
import styles from './BlurFramedImage.module.scss'
type BlurFramedImageProps = {
src: string
alt?: string
}
/**
* Renders an image within a frame, applying a blur effect to the image used as the background.
@ChrisCrossCrash
ChrisCrossCrash / Modal.tsx
Last active September 25, 2023 20:38
A React TypeScript component that uses the `HTMLDialogElement`.
import { useRef, useEffect } from 'react'
type ModalProps = {
className?: string
children: React.ReactNode
/** Whether the modal is currently open or not. */
isOpen: boolean
/** Function to set the modal's visibility state. */
@ChrisCrossCrash
ChrisCrossCrash / drone-ideas.md
Last active August 14, 2023 16:16
Drone Ideas

Drone Ideas

  1. Aerial Time-Lapse Photography: Program a drone to take off, fly to several locations, take photos, and land. After a year, the photos could be combined together to create a "changing of the seasons" time-lapse video.
  2. Aerial Delivery Drone: Program the drone to autonomously take off, fly to your current location (e.g., a boat on a lake), deliver an item, and then return to its starting point.
  3. Automatic Following Drone: Program a drone to follow you around and record your activities, creating a video with a third-person video game perspective. This could be used for sports, adventure recording, or creative cinematography.