Skip to content

Instantly share code, notes, and snippets.

View ashwch's full-sized avatar
😎
Look at me!

Ashwini Chaudhary ashwch

😎
Look at me!
View GitHub Profile
@ashwch
ashwch / claude_alert.sh
Last active July 2, 2025 22:08
Claude Code notifications hook for macOS using jq
#!/bin/bash
# Claude Code notifications hook for macOS using jq
# Reads JSON from stdin, plays a sound, and displays macOS alert
#
# Environment variables:
# CLAUDE_ALERT_SOUND - Sound name (default: Glass)
# Options: Basso, Blow, Bottle, Frog, Funk, Glass,
# Hero, Morse, Ping, Pop, Purr, Sosumi,
# Submarine, Tink
@ashwch
ashwch / uv_pep_723_example.py
Created March 5, 2025 05:25
UV and PEP 723 example
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import time
import statistics
@ashwch
ashwch / airtable.py
Last active July 9, 2020 00:39
Airtable to CSV
# Download Airtable's API response retrieved from browser console as CSV
import csv
import sys
import json
file_path = sys.argv[1]
with open(file_path) as f_in, open("airtable.csv", "w") as f_out:
data = json.load(f_in)
@ashwch
ashwch / supervisord.sh
Last active March 12, 2023 07:40
supervisord.sh for AWS-AMI
#!/bin/bash
#
# supervisord Startup script for the Supervisor process control system
#
# Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd)
# Jason Koppe <jkoppe@indeed.com> adjusted to read sysconfig,
# use supervisord tools to start/stop, conditionally wait
# for child processes to shutdown, and startup later
# Erwan Queffelec <erwan.queffelec@gmail.com>
# make script LSB-compliant
class classproperty(property):
def __get__(self, cls, type):
return self.fget.__get__(None, type)()
class ChoicesEnumMixin(object):
def __new__(cls, value, label=None):
type = cls.get_type()
if type is object:
@ashwch
ashwch / show.md
Created July 23, 2017 23:29
Show

This is possible when you import a module in shell and then make changes to the file but you are still using the same old module in shell. The solution is to reload the module or re-start the shell. This happens because the shell we try to load the latest code based up the error stack and display it to you.

# so.py
def func():
    print(foo.bar)

Start of shell session

>>> import so
### Keybase proof
I hereby claim:
* I am ashwch on github.
* I am ashwch (https://keybase.io/ashwch) on keybase.
* I have a public key whose fingerprint is E191 F0F5 7AB7 3DDC 850E 93EF BB99 A6BC 7284 052F
To claim this, I am signing this object:
@ashwch
ashwch / done_dona_done_done.py
Created November 13, 2015 11:36
done dona done done
# Shortest program to print 'done dona done done' without
# using any of the characters 'd', 'o', 'n', 'a' and 'e'.
# 46 characters.
x='\x64\x6f\x6e\x65';print x,x[:-1]+'\x61',x,x
@ashwch
ashwch / so.py
Last active August 29, 2015 14:19
with open('foo.txt', 'w') as f:
f.write('aa\n\rbbb\n\rcccc\n\rddddd')
with open('foo.txt') as f:
print f.readlines()
# ['aa\n', '\rbbb\n', '\rcccc\n', '\rddddd']