Skip to content

Instantly share code, notes, and snippets.

View av1d's full-sized avatar
🎯
Focusing

av1d

🎯
Focusing
View GitHub Profile
@av1d
av1d / telegram_gif.md
Last active May 30, 2024 18:47
Send animated GIF to Telegram with markdown text using cURL or Python

Replace with token, leave the 'bot' part in the URL.
Replace with your chat ID, example: -1234567890.
You may need to put -100 first, like: -1001234567890, depending on chat/group/channel type.
You can also use &parse_mode=html instead of markdown.

Bash:

@av1d
av1d / market.py
Last active May 30, 2024 06:17
Underwater Market Adventure - AI generated IF game (Meta Llama 2)
# Underwater Market Adventure
# (c) 2024 av1d
# MIT license
import time
def start_game():
print("Welcome to the Underwater Market Adventure!")
print("You are trapped in an underwater market, surrounded by Venus flytrap monsters.")
print("Your goal is to find the hidden key and escape the market inside a bubble you blew with bubblegum.")
@av1d
av1d / environment.sh
Last active May 30, 2024 14:15
get rk3588 environment
#!/bin/bash
# To help make it easier while troubleshooting issues for RK3588 LLM setups.
# Outputs to randomly-dated text file (ex: environment_2024-05-11_1715443021.txt)
# run: bash environment.sh
# find platform, assumes Debian/Ubuntu
platform=$(lsb_release -a)
@av1d
av1d / three_ai.py
Created May 3, 2024 16:57
Make 3 AI LLM models speak amongst themselves randomly (ollama, llama.cpp, RK3588 NPU server)
import json
import random
import re
import requests
import textwrap
# a random model is selected each time without the possibility
# of selecting the same one twice in a row (so it doesn't speak to itself)
# Terminal colors
@av1d
av1d / rkllm-update.cpp
Last active May 2, 2024 18:20
RK3588 NPU example, load prompt from text file
// Copyright (c) 2024 by Rockchip Electronics Co., Ltd. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@av1d
av1d / llama.py
Last active April 27, 2024 19:43
discord llama.cpp chat bot with context
import asyncio
import discord # discord.py==1.7.3
import re
import requests
import time
from collections import defaultdict
from discord import activity
from discord.ext import commands
# llama.cpp front end chat bot for Discord
@av1d
av1d / div.html
Created April 6, 2024 21:06
perfectly centered div
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Centered Div</title>
<style>
/* Styles to center the div */
.centered-div {
position: absolute;
@av1d
av1d / ai_menu.sh
Last active March 25, 2024 22:01
llama.cpp menu/launcher for storing models in one directory (folder) and easily loading them into llama.cpp quickly
#!/bin/bash
: <<'COMMENT'
Creates a menu system so it's easier to launch models. Example output:
[1] alicecomfy_miqu-70b-openhermes-full-b2131-iMat-c32_ch1000-IQ1_S_v3.gguf (13862 MB)
[2] deepsex-34b.Q2_K.gguf (13881 MB)
[3] ggml-model-q4_0.gguf (18564 MB)
[4] mistral-7b-instruct-v0.2.Q3_K_M.gguf (3355 MB)
[5] mlewdboros-l2-13b.Q3_K_L.gguf (6608 MB)
@av1d
av1d / bluetooth_repair.md
Last active February 27, 2024 18:16
Troubleshooting / repairing Bluetooth on Linux, bluetoothctl connection issues

Make sure you check dmesg periodically between these steps for errors...

First try this:

sudo apt-get update
sudo apt-get install --reinstall linux-modules-$(uname -r)
sudo apt-get install --reinstall linux-headers-$(uname -r)
sudo dkms autoinstall
hciconfig -a

if still nothing

@av1d
av1d / extract_links.py
Created February 24, 2024 06:22
extract relative & absolute paths from CSS and JS files