Phylosophy, Technology

How to pass API keys to Docker containers securely

This post is about how to pass API keys to Docker containers securely. The method I describe here can be handy for people who use Docker for small, personal projects. These type of projects usually not using Docker Swarm, hence, they do not have a built-in way to manage secrets.

I am using Linux pass password manager to store my API keys directly on my server. Because I do not store .env file with API keys on my server, I use special script, which generates ephemeral (temporary) .env file every time I start, restart or bring down the Librechat containers.

Read More…

Tips on how to use GenAI efficiently

I want to share few tips on how to use GenAI for the researching and learning efficiently:

  1. Build agents to your tasks.
    • Agent is just an LLM with precise and detailed instructions containing: the role LLM takes, area of expertise, what to take into account, how to process information (what to emphasize, what to ignore), format of answers, structure, markup (if needed). Tip: Use standard LLM model helping you with making instructions for your agent.
    • Provide to your agent only tools it needs, nothing extra.

Read More…

Private GenAI chat with Librechat.ai - Part 3

Let’s continue our journey of building a private GenAI chat with Librechat.ai. Part 2 of the series is here.

This post explains how to set up an API access to Google Search and YouTube. You will learn how to:

  • Create your Custom Search Engine and get its ID
    • This is the necessary step. This ID is used to identify your search engine when you make requests to the Google Search API. And you can also configure your search engine to your liking.
  • Create a new project in Google Cloud Console
  • Enable API access to Custom Search and YouTube Data API
  • Create API Keys and put restrictions on them

Read More…

Private GenAI chat with Librechat.ai - Part 2

This is second part of the series of articles about building your own private ChatGPT like web-chat with Librechat.ai. Introduction post is here.

In this post I describe how to set up secure access to LLM (Large Language Models) in Amazon Bedrock.

You will learn how to:

  • Create a new user with only necessary permissions. This user to be used by your Librechat.ai installation to access LLMs in Amazon Bedrock.
  • Generate access keys for the user.
  • Open access to LLMs of your choice in the Amazon Bedrock service.

Read More…

Private GenAI chat with Librechat.ai - Intro

This article is the first part of the series of articles about building your own private ChatGPT like web-chat with Librechat.ai.

If you don’t know what Librechat.ai is, here is a short demo of its capabilities:

The Librechat.ai instance from this video is running on my server and uses LLMs from Amazon Bedrock service. It also uses Google Search API and YouTube Data API to search for information and analyze content of the videos.

Read More…

Selecting AWS SSO profile for a terminal session with FZF

In this post I want to share with you my simple script which I use to select AWS SSO profile for a terminal session. As a developer of IaC for AWS, I have to switch between different AWS accounts and roles. In most cases customers use AWS Access portal (used to be known as SSO portal) for authentication and authorization. To quickly switch roles in the terminal I developed a simple script and aliases for shell to perform those operations quickly.

Read More…

AWS IAM Role Assumtion Pecularity

Hi all. I am staring to write a series of posts about AWS. This article is the first one in the series. The goal is not to provide a deep dive into the AWS services, but to share some interesting and useful tips about AWS, which I have learned on my projects.

Today I will outline an interesting peculiarity of AWS IAM role assumption. I think it is important to understand for building better permission and trust policies for your IAM roles. I identified this interesting behavior while working on a project where I needed to restrict which roles can assume a particular role inside the same account.

Read More…

MPV Player Control Scripts

I use Xmonad tiling window manager and MPV is my main player for music, videos, and Internet streams. Tiling window managers are great for hotkeys lovers, and I am one of them. I have a lot of key bindings which allow me to launch applications, make screenshots, control window positions, use so called scratchpads (special workspaces for often used applications).

And some time ago I decided to build a set of scripts which would allow me to control MPV player from the keyboard. I wanted to be able to play/pause, stop, seek, open folers, files and internet radio, etc. Another feature of my scripts is presentation of the current track information into the status bar. I use Xmobar, but you can use any status bar you like.

Read More…

My personal example of using math in programming

I was working on a small personal tool which adjusts the brightness via DDC protocol.

BTW, you can check the Github repository of it.

I wanted the tool which adjusts brightness automatically and gradually, using the time of the day and the season information. The first version which has been created perfectly fit my needs and had been working on my PCs for over 2 years.

Then I decided to share it with public and I started to work on its improvement. My goal was to generalize and parameterize the tool as much as possible, so that it could be used by other people with different requirements. And during this optimization I faced a problem with the brightness adjustment algorithm. Its initial implementation was rigid, built with if-else statements. I struggled with this problem for a while, looking for a fancy built-in Python modules or operators. Until I realized that what I need, is just to make a function. No, not the Python function, but the mathematical function!

Let’s go, I will show you how I did it.

Read More…