Skip to content

Instantly share code, notes, and snippets.

View abodacs's full-sized avatar

Abdullah Mohammed abodacs

View GitHub Profile
var $debugHelper = $debugHelper || {};
$debugHelper = function () {
var href = "lib/debugger.css";
var addCss = function () {
if (styleStyleIsLoaded(href) === true) {
return;
}
const head = document.head;
const link = document.createElement("link");
link.type = "text/css";
# SETUP #
DOMAIN=example.com
PROJECT_REPO="git@github.com:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
@MekkCyber
MekkCyber / kernel.py
Created August 29, 2024 14:24
Kernel for matmul while unpacking int2 weights
import torch
import triton
import triton.language as tl
def unpack_weights(packed: torch.Tensor, bits: int = 2) -> torch.Tensor:
values_per_item = 8 // bits
packed_shape = packed.shape
if len(packed_shape) == 1:
@karpathy
karpathy / add_to_zshrc.sh
Created August 25, 2024 20:43
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# But - just read and edit the code however you like
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/
gcm() {
@trvswgnr
trvswgnr / compress_video
Last active September 17, 2024 13:38
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@charlesfrye
charlesfrye / api.py
Last active August 1, 2024 19:46
LLaMA 3.1 405B Instruct FP8 - vLLM - OpenAI-compatible server
import modal
vllm_image = modal.Image.debian_slim(python_version="3.10").pip_install(
[
"vllm==0.5.3post1", # LLM serving
"huggingface_hub==0.24.1", # download models from the Hugging Face Hub
"hf-transfer==0.1.8", # download models faster
]
)
@Shpigford
Shpigford / .cursorrules
Last active September 17, 2024 20:38
Cursor Rules
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code.
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices.
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.
- Follow the user’s requirements carefully & to the letter.
@martinbowling
martinbowling / claudes-babyagi.py
Created July 8, 2024 21:29
claude's babyagi implementation
import os
from collections import deque
from typing import Dict, List
import time
import openai
# Configuration
OBJECTIVE = "Solve world hunger"
YOUR_API_KEY = "your-openai-api-key-here"
INITIAL_TASK = "Develop a comprehensive plan to solve world hunger"
@jph00
jph00 / contrastive.js
Created July 5, 2024 22:07
Chrome tampermonkey helper for the elderly
// ==UserScript==
// @name Keyboard Shortcut Scripts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Run scripts with keyboard shortcuts
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
from collections import Counter
from manim import *
import networkx as nx
import random
import numpy as np
import itertools
class UF:
def __init__(self, ids):