Skip to content

Instantly share code, notes, and snippets.

View p-i-'s full-sized avatar

Pi p-i-

View GitHub Profile
@p-i-
p-i- / 006.yaml
Created July 12, 2024 22:00
ARC Challenge example
train:
- input: |-
🔵 🔴 🟢 ⚫️ ⚫️ ⚫️ ⚫️
🔴 🟢 ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
🟢 ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
output: |-
@p-i-
p-i- / ask_claude.py
Last active September 3, 2024 20:46
Minimal wrapper around Anthropic's Claude HTTP API
from pathlib import Path
from os import environ
from time import sleep
from textwrap import dedent
import nestedtext as nt
import httpx
import arrow
API_KEY = environ.get('ANTHROPIC_API_KEY', None)
@p-i-
p-i- / bash_prompts.sh
Last active May 17, 2024 08:08
Coloured BASH Prompts
# PS1 etc requires wrapping non-printing characters
_np() { echo -ne "\[$1\]" ; }
# Generating ANSI escape codes
esc() { echo -ne "\e[$1m" ; } ; _esc() { _np "$(esc $1)" ; }
# Set foreground / background R G B (0-5 each)
rgb() { esc "$1;5;$((16 + 36 * $2 + 6 * $3 + $4))" ; } # FG/BG r g b
fg() { rgb 38 $@ ; } ; _fg() { _np "$(rgb 38 $@)" ; }
@p-i-
p-i- / nested.ipynb
Last active May 1, 2024 18:43
Use dot syntax to navigate JSON trees in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@p-i-
p-i- / rt_speech_chunker.py
Last active April 17, 2024 15:45
Realtime (Ultralow-latency) Speech Chunker using Voice Activity Detection (VAD) using WebRTC VAD
'''
# Realtime (Ultralow-latency) Voice Activity Detection (VAD) using WebRTC VAD
v3.2
π 17 Apr 2024
## Usage
```python
def on_segment(segment): # np.array of np.int16
print(f'☏ CALLBACK: Got segment: {len(segment)} frames')
@p-i-
p-i- / macos_realtime_stt__whisper.py
Created April 15, 2024 20:12
macOS Realtime Speech-To-Text using Whisper (locally)
'''
Adapted by π 15 Apr 2024
from https://github.com/davabase/whisper_real_time/blob/master/transcribe_demo.py
... which appears to have been itself pilfered from:
https://github.com/JihyeokKim/whisper_ros/tree/master/whisper_ros/src
To run on macOS:
- `brew install ffmpeg portaudio`
- Create requirements.txt:
```
@p-i-
p-i- / image-edit.ipynb
Created March 28, 2024 21:38
Demonstration (failing) of openAI's image-edit API
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@p-i-
p-i- / x.ipynb
Created November 23, 2023 16:02
FFF Naive PyTorch impl (3x slower than nn.Linear)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@p-i-
p-i- / x.ipynb
Created November 23, 2023 16:01
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.