Skip to content

Instantly share code, notes, and snippets.

View tazarov's full-sized avatar

Trayan Azarov tazarov

View GitHub Profile
@tazarov
tazarov / chroma-openapi.yaml
Last active August 6, 2023 08:29
OpenAPI 3.0 spec for Chroma vector databaseThis could be useful in generating clients for chroma
openapi: 3.0.2
info:
title: FastAPI
version: 0.1.0
paths:
/api/v1:
get:
summary: Root
operationId: root
responses:

Simplifying the process of utilizing OpenAI models' function calling capabilities, a new approach involves creating a meticulously structured JSON list. Consider the following example:

{
        "name": "get_current_weather",
        "description": "Get the current weather",
        "parameters": {
            "type": "object",
 "properties": {

This is a one-liner command to list and add a user as a reviewer to all pull requests in a github repo.

for pr in $(gh pr list --json number -q '.[].number'); do gh pr edit $pr --add-reviewer <user_id>; done

Note: The above works only in bash

kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" |\
tr -s '[[:space:]]' '\n' |\
sort |\
uniq -c

Installation

Check release in https://github.com/WireGuard/wireguard-vyatta-ubnt/releases

#https://github.com/WireGuard/wireguard-vyatta-ubnt/releases/download/1.0.20220627-1/ugw4-v1-v1.0.20220627-v1.0.20210914.deb

curl -OL https://github.com/WireGuard/wireguard-vyatta-ubnt/releases/download/1.0.20220627-1/ugw4-v1-v1.0.20220627-v1.0.20210914.deb
@tazarov
tazarov / my-admin-checker-mapper.js
Created February 23, 2023 15:27 — forked from Videl/my-admin-checker-mapper.js
JS for script mapper in Keycloak
// https://stackoverflow.com/questions/52518298/how-to-create-a-script-mapper-in-keycloak
// https://stackoverflow.com/questions/48199539/best-way-to-test-debug-javascript-mappers-policies-in-keycloak
// https://docs.oracle.com/javase/10/nashorn/nashorn-java-api.htm#JSNUG119
var client = keycloakSession.getContext().getClient();
var forEach = Array.prototype.forEach;
// print(user.getRealmRoleMappings());
var isAdmin = false;
@tazarov
tazarov / test_email.py
Last active January 25, 2023 21:19
Send email using AWS SES
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def test_send_mail():
# Replace [email protected] with your "From" address.
# This address must be verified with Amazon SES.
SENDER = "admin@org"
@tazarov
tazarov / kubernetes_service_session_affinity.md
Created January 20, 2023 17:15 — forked from fjudith/kubernetes_service_session_affinity.md
Enable Session Affinity (a.k.a Sticky Session) to Kubernetes service
@tazarov
tazarov / gen-ssl.sh
Created January 5, 2023 09:41 — forked from thbkrkr/gen-ssl.sh
Generate Self-Signed SSL Certificate without prompt
# Generate a passphrase
openssl rand -base64 48 > passphrase.txt
# Generate a Private Key
openssl genrsa -aes128 -passout file:passphrase.txt -out server.key 2048
# Generate a CSR (Certificate Signing Request)
openssl req -new -passin file:passphrase.txt -key server.key -out server.csr \
-subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*.krkr.io"
@tazarov
tazarov / ngrok-selfhosting-setup.md
Created January 4, 2023 11:55 — forked from lyoshenka/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems