Skip to content

Instantly share code, notes, and snippets.

@fxkamd
fxkamd / TinyGrad-notes.md
Last active April 26, 2024 15:34
Observations about HSA and KFD backends in TinyGrad

This is Felix Kuehling, long time KFD driver architect. I started looking into the TinyGrad source code yesterday, focusing on ops_kfd.py, ops_hsa.py and driver/hsa.py, to understand how TinyGrad talks to our HW and help with the ongoing debugging effort from the top down. This analysis is based on this commit: https://github.com/tinygrad/tinygrad/tree/3de855ea50d72238deac14fc05cda2a611497778

I'm intrigued by the use of Python for low-level programming. I think I can learn something from your use of ctypes and clang2py for fast prototyping and test development. I want to share some observations based on my initial review.

ops_kfd looks pretty new, and I see many problems with it based on my long experience working on KFD. I think it's interesting, but probably not relevant for the most pressing problems at hand, so I'll cover that last.

ops_hsa uses ROCr APIs to manage GPU memory, create a user mode AQL queue for GPU kernel dispatch, async SDMA copies, and signal-based synchronization with barrier packets

@thomwolf
thomwolf / fast_speech_text_speech.py
Last active April 26, 2024 10:03
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
@samuelcolvin
samuelcolvin / aicli.py
Last active March 2, 2024 16:04
OpenAI powered AI CLI in just a few lines of code - moved to https://github.com/samuelcolvin/aicli
#!/usr/bin/env python3
import os
from datetime import datetime, timezone
from pathlib import Path
from prompt_toolkit import PromptSession
from prompt_toolkit.history import FileHistory
import openai
from rich.console import Console
from rich.markdown import Markdown
@avi-perl
avi-perl / df_to_table.py
Last active December 15, 2022 21:27
Convert a pandas.DataFrame object into a rich.Table object for stylized printing in Python.
from datetime import datetime
from typing import Optional
import pandas as pd
from rich import box
from rich.console import Console
from rich.table import Table
console = Console()
COUNTRY BEEF PIG POULTRY SHEEP TOTAL
ARG 40.41400058 8.24187459 36.4689953 1.174247185 86.29911766
AUS 22.8010372 20.25072536 42.00750521 7.423454044 92.48272181
BGD 0.885267859 5.14E-04 1.223173534 1.163676301 3.272631248
BRA 24.15640871 11.20721696 39.36312514 0.393513724 75.12026453
BRICS 4.289081407 15.79587836 10.29847417 1.654767905 32.03820184
CAN 17.37132968 15.74658647 34.15846671 0.81704465 68.09342751
CHL 14.96778476 17.51448686 30.93243359 0.411750266 63.82645548
CHN 3.817396071 31.56769795 11.61724318 2.965417779 49.96775498
COL 12.10121226 5.084564383 26.43592901 0.202352547 43.8240582
@bradtraversy
bradtraversy / docker-help.md
Last active April 30, 2024 17:28
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@jamesluberda
jamesluberda / graphql-for-gists.md
Created June 20, 2018 01:07
Simple User Gists Query Using GitHub GraphQL API (v4 API)

I couldn't find any examples of gists queries using GraphQL--most GraphQL examples seem to focus on traditional repositories--so here is one. As a preface, I cannot recommend strongly enough, at least when getting started, developing queries using the GitHub GraphQL Explorer. I initially started by issuing queries via curl, constructing them using the docs available on the site and a downloaded copy of the schema. Unfortunately, I ended up with errors that I couldn't quite parse. I knew, for example, from the schema, the possible field values for ordering gists. However, whenever I tried to use one of those values, the API returned that it was invalid, like so:

{"data":null,"errors":[{"message":"Argument 'orderBy' on Field 'gists' has an invalid value. Expected type 'GistOrder'.","locations":[{"line":1,"column":48}]}]}"

When I finally turned to the Explorer, I discovered that not only was the value I was using correct (field: CREATED_AT), thanks to its auto

@0xjac
0xjac / private_fork.md
Last active May 3, 2024 18:34
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@sgnl
sgnl / serverCodes.md
Last active June 24, 2023 07:07
status codes

1xx: Information

Code Message Description
100 Continue The server has received the request headers, and the client should proceed to send the request body
101 Switching Protocols The requester has asked the server to switch protocols
103 Checkpoint Used in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Code Message Description
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal