Skip to content

Instantly share code, notes, and snippets.

View thapakazi's full-sized avatar
💭
🐧 🗡️ 💻

Milan Thapa thapakazi

💭
🐧 🗡️ 💻
View GitHub Profile
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.llms.ollama import Ollama
import logging
import sys
import os
import pickle
# logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
# logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
@thapakazi
thapakazi / docker-compose.yaml
Last active August 13, 2024 13:17
onetime secret docker compose minimal yaml
services:
app:
image: onetimesecret/onetimesecret:latest
container_name: onetime-app
depends_on:
- redis
environment:
HOST: "localhost:1234"
SSL: false
REDIS_URL: "redis://@redis:6379/0"
{
"description": "Caps Lock -> LeftCommand+Control+Shift+Option, Caps Lock -> Escape (if held alone for > 500 ms)",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
@thapakazi
thapakazi / install-tiny-proxy.yaml
Last active April 11, 2023 08:40
cat gpt generated yaml based on bash script ☺️
---
#
# Install ansible (like in ubuntu):
# sudo apt update
# sudo apt install software-properties-common
# sudo add-apt-repository --yes --update ppa:ansible/ansible
# sudo apt install -y ansible
# run with pull
# ansible-pull -U https://gist.github.com/thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 install-tiny-proxy.yaml -i "localhost," -c local
@thapakazi
thapakazi / sms_via_sns_using_iam_role.txt
Last active March 24, 2023 02:57
Using IAM role to send SMS via SNS
1. create sns topic
2. Under Amazon SNS > Text messaging (SMS)
Add your phone number and verify it with otp.
reason:
by default SMS is in sandbox mode: https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html
Need to create a support ticket to "Exit SMS Sandbox" :weird: which only allows us to send sms on verified number.
#!/bin/bash
set -e
stderr_log="/tmp/stderr.log"
exec 2>"$stderr_log"
notify() {
local exit_code=$?
local lineno=$1
if ! [ $exit_code -eq 0 ]; then
@thapakazi
thapakazi / duplicate_secrets_aws_secrets_manager.sh
Created October 26, 2022 01:42
duplicate existing secrets on aws secrets manager with prefix: /env/secret_name -> /env1/secret_name
#!/bin/bash
export AWS_PROFILE=nonproduction
export AWS_REGION=us-east-1
source_env=staging
dest_env=testing
SECRETS_DIR=/tmp/secrets && mkdir -p $SECRETS_DIR
SECRETS_ALL=$SECRETS_DIR/secrets.json
@thapakazi
thapakazi / Chart.yaml
Last active July 15, 2022 16:36
argocd-vault-plugin-test
apiVersion: v2
name: secret-app
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "0.1.0"

Keybase proof

I hereby claim:

  • I am thapakazi on github.
  • I am thapakazi (https://keybase.io/thapakazi) on keybase.
  • I have a public key whose fingerprint is D960 A6D6 BEC6 E198 1393 BFAB 00F2 8320 44FF 5DE8

To claim this, I am signing this object:

@thapakazi
thapakazi / postgres-cheatsheet.md
Created December 24, 2021 06:18 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)