Skip to content

Instantly share code, notes, and snippets.

@pigri
pigri / install.sh
Last active February 4, 2025 09:01
Setting up a Hetzner GPU server with Docker and GPU support.
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/
@pigri
pigri / README.MD
Created October 30, 2024 14:26
MockAI Readme

MockAI service

This is a mock service for multiple AI services.

Documentation

Documentation

OpenAI API

@pigri
pigri / index.ts
Last active October 4, 2023 16:24
Cloudflare worker - Example for Queue scaling
//https://www.npmjs.com/package/round-robin-js
import { RandomRoundRobin } from 'round-robin-js';
async function sender(queue: string, message: any, env: Env) {
try {
const processors = {
PROCESSOR1: env.ENVIRONMENT === 'dev' ? env.PROCESSOR1_DEV : env.PROCESSOR1,
PROCESSOR2: env.ENVIRONMENT === 'dev' ? env.PROCESSOR2_DEV : env.PROCESSOR2,
PROCESSOR3: env.ENVIRONMENT === 'dev' ? env.PROCESSOR3_DEV : env.PROCESSOR3,
PROCESSOR4: env.ENVIRONMENT === 'dev' ? env.PROCESSOR4_DEV : env.PROCESSOR4,
@pigri
pigri / backend-assiment.md
Created June 28, 2022 14:08
Persio - Test assigments

Back-end Test Assignment The goal of the assignment is to get a picture of your programming skills and coding style.

We prefer NodeJS or Go but you can choose any programming language that you're comfortable with.

Feel free to use 3rd party frameworks and libraries when needed, but try to choose lightweight ones because we'd also like to see how you think and code. Koa or Express (NodeJS), Flask (Python) or Sinatra (Ruby) are good examples of frameworks that give you just the basics and let you figure out the rest.

Don't stress if you can't get every part done -- spend a maximum of 5 hours on this assignment. Feel free to add comments or README notes to help us understand your thinking and decisions. If we like your code overall, we'll discuss the solution in person too so you'll get a chance to tell us what else you wanted to add and how you planned to implement those.

Feel free to ask questions to clarify the business need and the details. Also, try to estimate what can be done within the 5 hours time f

@pigri
pigri / script.sh
Created September 24, 2019 14:51
ENI cleaner
@export ENIS=$$(aws ec2 describe-network-interfaces --filters "Name=status,Values=available" | jq ".NetworkInterfaces[] | select(.VpcId == \"$${VPC_ID}\") | .NetworkInterfaceId"); \
if [[ ! -z $${DRY_RUN} ]]; then \
echo "Running in dry run mode! No changes will be made. The following ENIs would be deleted:"; \
echo $${ENIS}; \
exit 0; \
else \
for eni in $$(echo $${ENIS}| tr -d "\""); \
do \
aws ec2 delete-network-interface --network-interface-id $${eni}; \
done; \
@pigri
pigri / config.yml
Last active May 9, 2019 21:29
Desktop config
---
downloads: ~/.ansible-downloads/
configure_dotfiles: yes
configure_sudoers: yes
configure_terminal: yes
configure_osx: no
# dotfiles_repo: https://github.com/geerlingguy/dotfiles.git
# dotfiles_repo_accept_hostkey: yes
1. Debcsomagot akarsz gyártani a saját scriptedből (vgy bármilyen saját cuccból)
Csinálsz egy könyvtárat a szerveren, az alábbi szerkezettel:
csomagteszt
csomagteszt/DEBIAN
csomagteszt/DEBIAN/control
csomagteszt/usr/local/bin/myscript.sh
A DEBIAN/control file kb minimális tartalma az alábbi legyen, az alábbi mezők értelemszerűen:
@pigri
pigri / Dockerfile
Created September 19, 2016 19:37
Docker in homebridge
FROM ubuntu:12.04
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get install -y curl git make build-essential && \
apt-get install -y software-properties-common python-software-properties && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get install -y gcc-4.7 g++-4.7 && \
apt-get install -y libavahi-compat-libdnssd-dev && \
function evaluate(context){
var request = context.getCurrentRequest();
var jsonBody = request.jsonBody;
var json = jsonBody["build"]["commit_id"];
var response = json.substring(5,0);
return response;
};
variable "aws_amis" {
default = {
eu-central-1 = "ami-02211b1f"
ap-northeast-1 = "ami-22d27b22"
us-gov-west-1 = "ami-e53a59c6"
sa-east-1 = "ami-45a62a58"
ap-southeast-2 = "ami-2b2e6911"
ap-southeast-1 = "ami-0ef1f15c"
us-east-1 = "ami-6b1cd400"
us-west-2 = "ami-f5a5a5c5"