Skip to content

Instantly share code, notes, and snippets.

View andrewgazelka's full-sized avatar
πŸ€–

Andrew Gazelka andrewgazelka

πŸ€–
View GitHub Profile
@andrewgazelka
andrewgazelka / llm-rust.md
Last active July 1, 2025 20:31
Rust LLM Prompt

Rust Code Style Guide

Error Handling

  • Use eyre with bail! for early returns
  • ALWAYS add error context with wrap_err() at the callee (where error occurs), not caller
  • Add context even if it feels verbose - clarity > brevity

Control Flow

  • Early return pattern everywhere - fail fast
  • Maximum 3 levels of nesting - refactor if deeper
  • by default every cargo build recompiles EVERYTHING to do with sql...
  • let's improve speed by 2 orders of magnitude
  • By default make export SQLX_OFFLINE=true, i.e., in config.fish/zsh/bash
    • open RustRover from terminal rustrover . you might have to add rustrover to path. just make sure it opens with default environment SQLX_OFFLINE=true.
  • whenever you change a query in the dir of crate run SQLX_OFFLINE=false cargo sqlx prepare -- --tests from CLI to update queries.
  • now we will only recompile query-related stuff as needed (when we update a query)
@andrewgazelka
andrewgazelka / rp.zsh
Created June 29, 2023 14:08
Run commands in parallel
# run in parallel
rp() {
name=$(getuuid)
tmux new-session -d -s $name
# Get the total number of items.
total=${#items[@]}
# Initialize a counter.
count=1
@andrewgazelka
andrewgazelka / πŸ“Š Weekly development breakdown
Last active May 30, 2021 01:09
Weekly development breakdown
Rust 19 hrs 52 mins β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 62.1%
Dart 6 hrs 57 mins β–ˆβ–ˆβ–ˆβ–ˆβ–Œβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 21.7%
TypeScript 1 hr 19 mins β–Šβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 4.2%
Java 1 hr 1 min β–‹β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 3.2%
JavaScript 50 mins β–Œβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 2.6%
#include "LinkedList.h"
LinkedList::LinkedList() {
this->head = nullptr;
this->tail = nullptr;
}
void LinkedList::createNode(int value) {
auto *temp = new Node;
temp->value = value;
@andrewgazelka
andrewgazelka / config.fish
Last active January 5, 2019 06:29
Nice things to download
echo -ne "\033]6;1;bg;*;default\a"
echo -ne "\033]6;1;bg;blue;brightness;255\a"
alias tm="tmux -CC attach"
alias rn="tmux rename-window"

Keybase proof

I hereby claim:

  • I am andrewgazelka on github.
  • I am andrewgazelka (https://keybase.io/andrewgazelka) on keybase.
  • I have a public key ASCXImfcP9gRFmAPB0PvqkKmcRNqf0csd4NgM--LbLoKKwo

To claim this, I am signing this object:

package com.oneshotmc.factionworlds.core;
import org.hibernate.Session;
public class HibernateTest {
public static void main(String[] args) {
Person person = new Person();
person.setName("person_name");
person.setId(1);
package com.oneshotmc.factionworlds.core;
import org.hibernate.Session;
public class HibernateTest {
public static void main(String[] args) {
Person person = new Person();
person.setName("person_name");
person.setId(1);
@andrewgazelka
andrewgazelka / CMakeLists.txt
Created March 23, 2018 17:47 — forked from antonagestam/CMakeLists.txt
CLion and Arduino via Platform.io
cmake_minimum_required(VERSION 3.2)
project(YourProject)
add_subdirectory(src)
add_subdirectory(lib)