Skip to content

Instantly share code, notes, and snippets.

@max-arnold
max-arnold / salt_zsh_bash_completion.md
Last active January 11, 2022 22:07
SaltStack Zsh and Bash completion

Zsh

mkdir -p ~/.zsh/completions
wget -q https://raw.githubusercontent.com/saltstack/salt/master/pkg/salt.zsh -O ~/.zsh/completions/_salt
sed -i'' -e 's/python2/python/' ~/.zsh/completions/_salt
# ~/.zshrc
@max-arnold
max-arnold / ydb-tli-test.py
Created December 4, 2022 11:35
YDB async Python playground script to trigger the TLI scenario
#!/usr/bin/env python
import os
import asyncio
import ydb
JOB_DDL = """
CREATE TABLE job (
id String NOT NULL,
status String,
@max-arnold
max-arnold / python-static-site-generators.txt
Last active January 27, 2023 11:09
List of static blog/site generators written in Python
http://blohg.org/
http://getnikola.com/
http://markdoc.org/
http://mulholland.xyz/docs/ivy/
http://mynt.mirroredwhite.com/
http://obraz.pirx.ru/
http://pelican.readthedocs.org/en/latest/
http://pyfolio.org/
http://pypi.python.org/pypi/jules
http://pythonhosted.org/swg/
@max-arnold
max-arnold / modinfo.py
Created November 14, 2023 02:24
Salt module info
#!/usr/bin/env python3
import argparse
import ast
import os
import sys
def parse_module(mod):
with open(mod, "r") as source:
@max-arnold
max-arnold / salt-ssh-vs-heist.md
Last active January 31, 2024 15:04
Salt SSH vs Heist

Feature parity between Salt SSH and Heist

Salt SSH features

@max-arnold
max-arnold / listen.py
Created February 25, 2024 02:35
Continuous voice recognition in Emacs using Yandex Speechkit
# Based on https://cloud.yandex.ru/ru/docs/speechkit/stt/api/microphone-streaming
import pyaudio
import wave
import argparse
import grpc
from datetime import datetime
import time
import queue
import sys
@max-arnold
max-arnold / yc-agw.py
Last active March 18, 2024 09:28
Test Yandex Cloud Functions written in Python and invoked as API Gateway integrations locally
#!/usr/bin/env python
"""
Test Yandex Cloud Functions written in Python and invoked as API Gateway integrations locally.
Heavily based on https://github.com/amancevice/python-lambda-gateway
MIT License
Copyright (c) 2020 Alexander Mancevice
Copyright (c) 2022-2023 Max Arnold
@max-arnold
max-arnold / SALT-EXTENSION.md
Created March 27, 2024 05:07
Salt extension development environment

Here is how I set up my extension development environment on Ubuntu 22.04:

git config --global user.name "Name"
git config --global user.email "email@example.com"
git clone git@github.com:USER/saltext-my.git
cd saltext-my
sudo apt install python3-venv python3-dev build-essential python3-wheel python3-wheel-whl
python3 -m venv .venv
source .venv/bin/activate
"""
1. Install the following dependencies into a virtualenv
pip install textual==0.57.0 textual-dev==1.5.1 requests==2.31.0 requests-aws4auth==1.2.3 yandexcloud==0.267.0
2. Create a env.json file
{
"YC_REGION": "ru-central1",
"YC_FOLDER_ID": "FFF",