Skip to content

Instantly share code, notes, and snippets.

View habedi's full-sized avatar
🪬

Hassan Abedi habedi

🪬
View GitHub Profile
@habedi
habedi / writing_guide_for_AI.md
Last active September 5, 2026 18:19
My personal writing style guide for AI agentic tools like Claude Code and Codex

Writing Style

  • Write in simple, plain English. Use short sentences and everyday words.
  • Use Oxford commas in inline lists: "a, b, and c" not "a, b, c".
  • Do not use em dashes. Restructure the sentence or use a semicolon instead. User emojis scarcely.
  • Avoid colons in the middle of sentences. A colon that introduces a code block or a list is fine; existing text is reworded when it is touched anyway, not in a sweep.
  • Avoid colorful adjectives and adverbs. Write "adjacency query" not "blazing adjacency query".
  • Prefer noun phrases for checklist items over imperative verbs. Write "temp directory teardown" not "tear down the temp directory".
@habedi
habedi / concurrent_writes.zig
Created July 25, 2026 12:24
Performing concurrent writes (to STDOUT) using a lock and a queue, in Zig 0.16.0
const std = @import("std");
const LogMessage = struct {
worker_id: usize,
msg: []const u8,
};
const LogQueue = struct {
mutex: std.Io.Mutex = .init,
list: std.ArrayListUnmanaged(LogMessage) = .empty,
@habedi
habedi / reader_atEnd.zig
Created May 5, 2026 18:41
Example code showing the behavior of `std.Io.File.Reader.atEnd`
const std = @import("std");
pub fn main(init: std.process.Init) !void {
const io = init.io;
const cwd = std.Io.Dir.cwd();
// Create a test file
{
const f = try cwd.createFile(io, "demo.txt", .{});
defer f.close(io);
@habedi
habedi / file.zig
Created April 21, 2026 19:06
Reading from a text file in Zig `0.17.0-dev.56+a8226cd53`
// This is `file.zig`
// Run: ~/.local/share/zig/0.17.0-dev.56+a8226cd53/zig run file.zig
const std = @import("std");
pub fn main(init: std.process.Init.Minimal) !void {
// Set up a general-purpose allocator.
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
defer _ = debug_allocator.deinit();
const gpa = debug_allocator.allocator();
@habedi
habedi / jail-claude.sh
Last active May 20, 2026 11:08
A script to run Claude Code in a jail environment using Bubblewrap on Linux
#!/bin/bash
# Installing Bubblewrap on Debian or Ubuntu
# sudo apt install bubblewrap
# sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
CLAUDE=$(which claude 2>/dev/null || echo "$HOME/.local/bin/claude")
NODE=$(which node 2>/dev/null)
if [[ ! -f "$CLAUDE" ]]; then
@habedi
habedi / .pre-commit-config.yaml
Last active August 9, 2025 10:52
A generic pre-commit configuration file for projects managed by GNU Make
default_stages: [ pre-push ]
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: end-of-file-fixer
@habedi
habedi / code_review_principles.md
Created July 24, 2025 08:37
Code Review Principles

Code Review Principles

  1. Don't write comments based on opinion or gut feeling. Have a reason. If possible, back it up with a reference (style guide, docs, performance data, etc).

  2. Write full sentences and don’t leave out context. Be clear so the reader doesn’t have to guess what you mean.

  3. Avoid vague "why?" questions. If something is not clear, ask for clarification in a specific way. If something needs changing, suggest the change and explain why.

@habedi
habedi / DependencyHunterLite.md
Last active April 29, 2025 02:21
Finding dangling assets in Unity #unity #utilities #script

This is a minimal version of Unity-Dependencies-Hunter in less than 100 lines of code. It scans all assets in the project, checks their dependencies, and lists those that are not referenced by any other asset.

Put it in the Assets/Editor directory and run it from Tools -> Unreferenced Assets Finder.

using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
@habedi
habedi / unity-maming-conventions.md
Last active August 11, 2026 18:37
Naming conventions for #Unity projects

Unity Naming Conventions

Using consistent naming conventions in Unity projects helps keep everything organized and easy to work with. Below is a list of recommended conventions for naming components, scripts, variables, methods, folders, and game objects in a Unity project.


General Rules

  1. PascalCase for Classes:
  • Use PascalCase for class names (e.g., PlayerController, GameManager).
@habedi
habedi / CreateUnityProjectStructure.ps1
Last active September 11, 2026 11:09
A PowerShell script to create a Unity project struture (execute: `.\CreateUnityProjectStructure.ps1` in PoweShell to run)
# This script creates a basic Unity project structure in the current directory.
# To run the script, open a PowerShell terminal and execute the following command:
# .\CreateUnityProjectStructure.ps1
param(
[string]$BaseDir = (Get-Location).Path
)
# Function to create a directory and handle errors
function Create-Dir {