Install k3s on master node:
curl -sfL https://get.k3s.io | sh -
# get token
cat /var/lib/rancher/k3s/server/node-token
Install k3s on worker nodes as agents:
#Принудительно меняем раскладу для Konsole и kitty | |
#Для телеграм меняем на Русский | |
#Для всего остального меняю на английский | |
from i3ipc import Connection, Event | |
import subprocess,os | |
Install k3s on master node:
curl -sfL https://get.k3s.io | sh -
# get token
cat /var/lib/rancher/k3s/server/node-token
Install k3s on worker nodes as agents:
Proof of concept of distributed rate limiting multiple workers processing speed.
Rate limiting follows a leaky bucket algorithim. The bucket is implemented using a speical token-bucket queue. Max size of the bucket is enforced by using the max length of a token queue. The bucket is refilled by a single worker, which also is responsible for the refill rate.
Workers must get a token before fetching and processing any tasks.
from flask import Flask | |
import webview | |
import sys | |
import threading | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' |
""" | |
This is a simple example of usage of CallbackData factory | |
For more comprehensive example see callback_data_factory.py | |
""" | |
import asyncio | |
import logging | |
from aiogram import Bot, Dispatcher, executor, types | |
from aiogram.contrib.fsm_storage.memory import MemoryStorage |
#!/bin/bash | |
setting=$(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled) | |
if [[ $setting == "true" ]]; then | |
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false | |
else | |
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true | |
fi |
# -*- coding: latin-1 -*- | |
# Copy this python script under ~/.local/share/nautilus-python/extensions and restart nautilus. | |
# You may need to create nautilus-python and extensions folders if they do not exist. – | |
import os | |
import gi | |
gi.require_version('Nautilus', '3.0') | |
from gi.repository import Nautilus, GObject |
from subprocess import Popen, PIPE, call | |
import logging | |
import logging.handlers | |
import sys | |
import os | |
# NOTE: this script assumes a debian system and requires the wmctrl and xdotool packages | |
# sudo apt-get install wmctrl xdotool | |
# NOTE: To get [Alt + ` ]to register on Elementary OS requires removing the keybinding via dconf editor for switch-group/switch-group-backward |
from nameko.standalone.rpc import ClusterRpcProxy | |
config = { | |
'AMQP_URI': 'amqp://guest:guest@localhost:5672/' | |
} | |
with ClusterRpcProxy(config) as rpc: | |
session_token = rpc.auth.login("admin", "secret") | |
with ClusterRpcProxy(config, context_data={'session': session_token}) as rpc: |
""" | |
xonsh history backend with couchdb. | |
Copy this file to "~/.xonsh/history_couchdb.py" and put the following | |
into your "~/.xonshrc" file. | |
import os.path | |
import sys | |
xonsh_ext_dir = os.path.expanduser('~/.xonsh') | |
if os.path.isdir(xonsh_ext_dir): |