Skip to content

Instantly share code, notes, and snippets.

View bearlike's full-sized avatar
🍄
+1UP

Krishnakanth Alagiri bearlike

🍄
+1UP
View GitHub Profile
@bearlike
bearlike / ToolCreator_Prompt_Template.md
Created September 21, 2024 08:43
Prompt Template for creating a new OpenWebUI tool

Below is an example of a tool that can be used with the OpenWebUI LLM. You must understand how the below code works and create a new well-documented tool that provides the desired functionality based on the new user requirement. Functions in the Tools class are exposed to LLM for tool selection. Functions in the Utils class are not exposed to LLM and are meant to be used as development helper functions. The EventEmitter class is used to emit events to the OpenWebUI. The Valves class is used to define the user configuration parameters for the tool. The some_functionality_exposed_to_LLM function is an example of a function that is exposed to the LLM. The some_helper_function_not_exposed_to_LLM function is an example of a function that is not exposed to the LLM. The main function is an example of how to run the tool locally. The main function is not exposed to the LLM. Each function in Tools represents a new exposed function to the LLM. There can be many functions in Tools available for LLM f

@bearlike
bearlike / docker_tool.py
Created September 21, 2024 07:33
OpenWebUI Docker Tool
"""
title: Get Information on Docker Containers
author: KK
funding_url: https://github.com/bearlike
version: 0.1.0
license: MIT
"""
from datetime import timedelta, datetime
from typing import Callable, Any, Tuple
@bearlike
bearlike / qb_tool_webui.py
Created September 20, 2024 22:22
Explore Torrents managed by my qBittorrent Instance. Tool for OpenWebUI
"""
title: Explore Torrents managed by my qBittorrent Instance. Tool for OpenWebUI
author: KK
funding_url: https://github.com/bearlike
version: 0.1.3
license: MIT
"""
from qbittorrent import Client
from pydantic import BaseModel, Field
@bearlike
bearlike / WiFi_AP_Fire_TV_Custom_AP.md
Last active August 31, 2023 05:20
A step-by-step guide to configure a Raspberry Pi 4 as a WiFi AP with DNS blocking capabilities, tailored to overcome hard-coded DNS settings in Fire TV for an ad-free experience.

Raspberry Pi 4 - WiFi Access Point with DNS Blocking and Pi-Hole Integration

This tutorial will guide you through setting up a Raspberry Pi 4 as a WiFi Access Point (AP) and blocking specific DNS servers, using 8.8.8.8 as an example.

Why should you do this?

You're setting up a Raspberry Pi 4 as a WiFi Access Point (AP) to gain more control over your network, specifically to address limitations in your current router. The primary goal is to block specific DNS servers, like 8.8.8.8, which some devices, such as the Fire TV, use by default. By doing so, you aim to prevent these devices from bypassing your preferred DNS settings, which you've configured to block ads using Pi-Hole. This setup ensures a consistent ad-free experience across all devices connected to the AP, even if they have hardcoded DNS settings.

Prerequisites

  • Raspberry Pi 4 (tested) or similar.
@bearlike
bearlike / docs.md
Last active May 27, 2023 21:35
Understanding License types and GitHub CICD

Krishna's 2-cents:

My understanding of GitHub Action Workflow files

As far as I know (and in my opinion), focusing on these below potential inputs should be a good starting point for engineering language models for generating workflow files, not exclusive to GitHub Actions [CI/CD]:

  • Workflow Name: A name for the workflow file, eg., "CI", "test", "deploy".
  • On Events: What (kind of) events trigger the workflow. This could be any events such as 'push', 'pull_request', or a on complex structures, it could be an API call with payloads. But for now, focusing on simpler events, should get the job done.
  • Environment Variables: Any environment variables that the workflow needs.
  • Jobs: A list of jobs that the workflow should run. Imagine, complete a serives of sub-tasks to compete a bigger task. Each job is roughly an object should atleast contain the below:
    • Job Name
@bearlike
bearlike / Nextcloud_update.sh
Last active November 7, 2022 20:37
Manually update Nextcloud (docker) to the latest version
cd /AppData/nextcloud
# Download latest version
sudo wget https://download.nextcloud.com/server/releases/nextcloud-<VERSION>.zip -O /AppData/nextcloud/nextcloud.zip
sudo unzip /AppData/nextcloud/nextcloud.zip
# Stopping container
docker stop nextcloud-app-1
# Backup old files, move apps and old configurations.
@bearlike
bearlike / docker-compose.yml
Created April 9, 2022 09:23
Docker stack for Nextcloud. (Nextcloud + MariaDB)
version: '3'
services:
mariadb:
image: mariadb:10.7.3-focal
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- /AppData/nextcloud/mariadb:/var/lib/mysql
environment:
@bearlike
bearlike / fancy_rpi_motd.md
Last active March 23, 2022 21:41
New Fancy MOTD

Fancy MOTD for Raspberry Pi

Demo

Code

#!/bin/bash
# Login MOTD for Raspberry Pi
print_line () {
	for i in {0..50..1}
@bearlike
bearlike / clear_systemd_journal_logs.md
Created March 8, 2022 07:59
Clear Systemd Journal Logs in Ubuntu 20.04

Clear Systemd Journal Logs in Ubuntu 20.04

Systemd has its own logging system called the journal, and the log files are stored in /var/log/journal.

Check current disk usage of journal files

sudo journalctl --disk-usage

Rotate journal files

  • Active journal files will be marked as archived, so that they are never written to in future.
@bearlike
bearlike / docker-compose.yml
Last active March 5, 2022 17:37
Docker stack with Jupyter, MySQL server and PMA configured for quick access.
version: "3.9"
services:
jupyter:
image: jupyter/minimal-notebook
container_name: jupyter
ports:
- "81:8888"
volumes:
- /home/kk/jupyter/notebooks:/home/jovyan/