Categories
Common

Using AI in programming Part 2

Here i will describe how to install the code llama modell on one of your VM’s. Problem here is that you usually loose the GPU support because MS is still not able to provide GPU-P for Hyper-V. TY MS at this point.

First prepare a vm, I’m choosing ubuntu srv 22.04.03 LTS. Assigning 8 cores and 64GB of RAM.

Check if git is installed (insert “git –version” in the terminal):

Clone the llama.cpp project, insert the following commands in the terminal (“make” w/o anything is cpu only, you may need to install the gcc compiler):

git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
sudo apt install build-essential //gcc compiler
make

Downloading the model can be done with a nice script:

bash <(curl -sSL https://g.bodaay.io/hfd) -m TheBloke/CodeLlama-70B-hf-GGUF --concurrent 8 --storage models/

After downloading the modell, we can start llama.cpp.

./server \
    --model ./models/TheBloke_CodeLlama-70B-hf-GGUF/codellama-70b-hf.Q5_K_M.gguf --host 192.168.50.13 --port 8080 -c 2048

Next step would be to create a plugin for VS e.g. to autofill code from commentblock.

Categories
Common

Using AI in programming

This is a an example on how to use AI in your own environment. I’m using the popular LLM Code Llama from Meta which is open source (also for commercial use) and supports C#, my main programming language. Another advantage is that you can use it in your own environment and your most value asset the sourcecode will not leave your network.

Code Llama comes in different sizes, I’m currently using the 70B Model which returns the best result but requires quite a bit of resources. I’m showing you how to self host a tool which runs the llm locally on a central server and write a simple VSCode extension to access the api to query results.

But first lets try to run it locally on my development machine. For this just install ollama (MIT License) and select the model from meta.

It usually gives you a code snipped and an explanation. It works, but it may be a bit inconvenient. In the next post, I’ll show you how to run the modell on your own virtual environment and access it via web or inside your code editor.

Categories
Common

Failed to start gitea on Fedora 38 after update

Maybe this helps other user. Just updated gitea and service refused to start: Process: 48241 ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini (code=exited, status=203/EXEC)

In the log (journalctl -b 0 -u gitea) there are permission issues: gitea.service: Failed at step EXEC spawning /usr/local/bin/gitea: Permission denied

I checked permissions and they are ok. Found out that selinux flagged that file as user_home_t as it was downloaded to that location.

Fixed the issue with command (sudo restorecon -rv /usr/local/bin/gitea) to remove the user_home flag.

Categories
Common

Automatisierung des Postident Portals

Aus einem Kundenprojekt kam die Anfrage den Identifizierungsprozess z.b. mittels Personalausweis und Videoident einfach über einen internen Prozess starten zu können und die Ergebnisdaten nach Abschluss des Falles entsprechend zu verarbeiten. Das Projekt wurde in C#/Asp.Net umgesetzt und läuft auf einem internen Webserver. Die Ergebnisdaten werden per Cronjob einmal am Tag abgerufen und bei Änderungen im Status entsprechend behandelt, zumeist archiviert.

Der Code stellt nur Ausschnitte des Projektes dar, wer Interesse an einer konkreten Implementierung hat kann sich gerne an mich wenden.

Prepare a call to create a new case:

Perform api call and process result with caseId:

Categories
Common

SSD upgrade on a Samsung Galaxy Flex 2 5G (not possible)

Seems that the Notebook uses not a standard 2280 m.2 SSD but instead a much smaller one (maybe 2230). I just wanted to install a Samsung 980 Pro on my exemplar but aborted the operation.

The SSD is above the Battery in the middle.

The SSD is under the Metal Frame in the Middle above the Battery.

Btw.: Disassembly is pretty easy: Just remove 4 screws and use a suction cup on the front corner on the bottom (not on back side at hinge area which seems to be much stronger).

Categories
Common

Enable containers in Windows Server 2019 to Host Docker Containers

Use PowerShell to install the docker module with the following commands and reboot the server.

Please also refer to the original Microsoft documentation -> here .

Categories
Common Home-Server

Automation of backup jobs

Today i want to start automating my tasks. This time i want to automate a backup task written in Python. In general the script collects mySQL database exports in zip-format and copies them into a folder which is then protected with a raid and a backup. I’m using a python script on the Windows Tasks Scheduler for this job.

See my wiki for a how to.