Skip to content

Instantly share code, notes, and snippets.

View codemartial's full-sized avatar

Tahir Hashmi codemartial

View GitHub Profile
@codemartial
codemartial / CLAUDE.md
Created August 20, 2026 10:32
Fix Fablespeak

@AGENTS.md

Written-register rule

Write in full written prose, not transcribed speech. Speech relies on tone and gesture that text does not carry, so the following spoken patterns are banned:

  • Verbless fragments used as topic headers inside prose, such as "Orphan files." followed by commentary. Instead write a full
@codemartial
codemartial / hello.go
Created August 5, 2026 02:15
A buggy multi-process hello world.
package main
import (
"bufio"
"fmt"
"net/http"
"os"
"sync"
)
@codemartial
codemartial / find-sidecar.el
Created July 23, 2026 01:32
Emacs command to open a file and its side car side-by-side
(defun find-sidecar (file extension)
"Open FILE and its EXTENSION sidecar in adjacent windows.
Prefer an existing window to the left, then one to the right."
;; Usage:
;; M-x find-sidecar RET
;; File: path/to/file.ext RET
;; Sidecar extension: ext2 RET
;;
;; Opens:
@codemartial
codemartial / caption-photos.md
Created June 1, 2026 08:43
Photo Captioning Skill for Claude Code
name caption-images
description Extract embedded JPEGs from RAW files, visually examine them, and write headlines, captions, and keywords into XMP sidecar files. Reads job context from an optional first-argument job file (`.md`/`.txt`)

Caption the image files provided and write the results into their XMP sidecar files.

Arguments: $ARGUMENTS

If the first argument is a .md or .txt file, it is a job description; all remaining arguments are image files. Otherwise every argument is an image file.

@codemartial
codemartial / flickr.html
Last active April 13, 2023 09:59
Awesomest Hugo shortcode for Flickr photos. Responsive images, EXIF data, custom titles 👍
{{/*
Flickr shortcode for Hugo
Usage: {{< flickr photo_url="https://www.flickr.com/photos/username/1234567890" title="Photo title" >}}
Parameters:
photo_url: URL of the photo on Flickr
title: Title of the photo
caption: Caption of the photo (disables EXIF info)
href: URL of the link (overrides photo_url)
Output:
<figure>
@codemartial
codemartial / exiftool-examples.md
Last active May 31, 2021 02:56
A collection of exiftool recipes from my usage

Exiftool Examples

Following is a collection of real exiftool commands that I've used, along with explanations of what each does. exiftool is a command-line utility that provides very powerful EXIF reading, writing and searching capabilities.

I'm writing this down because I often spend a lot of time reading through exiftool documentation to find out how to get something done, just to forget it within hours. All of these examples work on a Unix shell environment like ZSH on MacOS or the various Linux shells.

Extracting EXIF Information

What does EXIF data look like? Let's try the following on an image file, DSC09535.JPG:

@codemartial
codemartial / redis-worker.go
Created April 17, 2018 05:53
A worker pool for executing Redis commands using redigo
package main
import (
"fmt"
"github.com/gomodule/redigo/redis"
"sync"
"time"
)
var rconns *redis.Pool
@codemartial
codemartial / ccf.go
Last active April 24, 2018 12:02
Co-ordinated Cache Filling using Redis Distributed Locks
package main
import (
"fmt"
"github.com/gomodule/redigo/redis"
redsync "gopkg.in/redsync.v1"
"sync"
"sync/atomic"
"time"
)
@codemartial
codemartial / bebo.go
Created February 14, 2018 11:53
Binary Exponential Back-Off Scheduler in Go
// BEBOSchedule computes a Binary Exponential Back-Off schedule given the following:
// retries: maximum number of retry attempts
// waittime: maximum number of seconds from the first attempt after which the operation is permanently failed
//
// The schedule is returned as a list of seconds since first attempt at which a retry must be made
// The schedule will have as many entries as the maximum number of attempts given
func BEBOSchedule(retries, waittime int) ([]uint, error) {
if retries <= 0 || waittime <= 0 || waittime < 1<<uint(retries)-1 {
return []uint{}, fmt.Errorf("Invalid retries or waittime")
@codemartial
codemartial / wald.go
Last active November 25, 2017 02:57
Table of minimum percentages estimated using Adjusted Wald Method at 99% confidence
package main
import (
"fmt"
"math"
)
func max(l, r float64) float64 {
if l > r {
return l