Skip to content

Instantly share code, notes, and snippets.

View eriknomitch's full-sized avatar

Erik Nomitch eriknomitch

View GitHub Profile
@eriknomitch
eriknomitch / README.md
Last active January 4, 2024 21:13
aider-commit: Automatic git commit messages with aider

aider-commit

A simple wrapper for using aider to create commits with automatically generated messages using AI. Includes a few extra checks and outputs.

Installation

  1. Set up aider
  2. Add the function to your ~/.zshrc or ~/.bashrc.

Usage

@kylemcdonald
kylemcdonald / pyaudio-test.py
Created October 11, 2023 09:27
Show microphone level in realtime using pyaudio.
import pyaudio
import audioop
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16,
channels=1,
rate=44100,
input=True,
frames_per_buffer=1024)
@veekaybee
veekaybee / chatgpt.md
Last active May 18, 2024 11:41
Everything I understand about chatgpt

ChatGPT Resources

Context

ChatGPT appeared like an explosion on all my social media timelines in early December 2022. While I keep up with machine learning as an industry, I wasn't focused so much on this particular corner, and all the screenshots seemed like they came out of nowhere. What was this model? How did the chat prompting work? What was the context of OpenAI doing this work and collecting my prompts for training data?

I decided to do a quick investigation. Here's all the information I've found so far. I'm aggregating and synthesizing it as I go, so it's currently changing pretty frequently.

Model Architecture

"""
Toy demonstration of chain-of-thought and consensus prompting using OpenAI API.
© Riley Goodside 2022
"""
import os
import re
from statistics import mode
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
# *Only* converts the UNet, VAE, and Text Encoder.
# Does not convert optimizer state or any other thing.
# Written by jachiam
import argparse
import os.path as osp
import torch
@ibrennan
ibrennan / useVisibilityState.js
Last active February 20, 2024 21:23
useVisibilityState - A simple React Hook for tracking document.visibilityState, useful for things like suspending API polling on inactive tabs
import { useState, useEffect, useCallback } from 'react';
export const useVisbilityState = () => {
const [visibilityState, setVisibilityState] = useState(null);
const handleVisbilityChange = useCallback(() => {
setVisibilityState(document.visibilityState);
}, [setVisibilityState]);
useEffect(() => {
@ramast
ramast / pulse-recorder.py
Last active September 3, 2023 11:12
Record a program's output with PulseAudio
#!/usr/bin/env python3
# Based on code from these stackoverflow answers:
# https://askubuntu.com/questions/60837/record-a-programs-output-with-pulseaudio/910879#910879
import re
import subprocess
import sys
import os
import signal
from time import sleep
@wonderbeyond
wonderbeyond / fields.py
Last active February 15, 2023 13:13
Generic foreign key field for peewee based on postgresql's jsonb type, with Inter-Model-Identifier(IMID) support.
import six
from peewee import Model, FieldAccessor
from playhouse.postgres_ext import BinaryJSONField
class GForeignKeyAccessor(FieldAccessor):
def get_rel_instance(self, instance):
value = instance.__data__.get(self.name)
model_name = value['model']
rel_model = self.field.allowed_types[model_name]

Google Apps Script to automatically delete mails with a certain label after a certain time

Usage

  1. Think of a deletion scheme and create GMail labels accordingly (e.g. I use labels 'todelete/after1week', 'todelete/after1month' and 'todelete/after3months' here)
  2. set up filters in GMail to flag desired mails with these labels
  3. create a Google Apps Script with this script (adapt function names, labels and day offsets appropriatedly) and set up triggers as desired

Disclaimer

@kevinzakka
kevinzakka / data_loader.py
Last active April 19, 2024 23:42
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np