Skip to content

Instantly share code, notes, and snippets.

View spirkaa's full-sized avatar
🏠
Working from home

Ilya Pavlov spirkaa

🏠
Working from home
View GitHub Profile
@spirkaa
spirkaa / README.md
Last active July 6, 2022 17:09
Nginx Proxy Manager oauth2-proxy auth_request

Nginx Proxy Manager oauth2-proxy auth_request

Replace oauth2-proxy.example.com with your value and paste into NPM -> Edit Proxy Host -> Advanced tab

@spirkaa
spirkaa / ansible_vault_rekey.py
Last active March 31, 2022 17:56
Rekey individually encrypted Ansible Vault variables in-place.
#!/usr/bin/env python3
"""
Rekey individually encrypted Ansible Vault variables in-place.
Accepts literal passwords or password files and list of file paths.
Usage: python ansible_vault_rekey.py .old_password_file .new_password_file $(find . -type f -name "*.yml") one.yaml two.vault.yml
For each input file:
- Read the input file and extract sequences that match the vault regex
@spirkaa
spirkaa / clone_repos_json.py
Last active May 6, 2023 05:44
Clone/pull multiple git repos simultaneously with ThreadPool
#!/usr/bin/env python3
"""Parse json and clone repos in specific directory."""
import json
import logging
import subprocess
from multiprocessing.pool import ThreadPool
from pathlib import Path
logger = logging.getLogger(__name__)
"""
1. Parse markdown file and extract urls to github.com repos
2. Clone repos in specific directory
"""
import logging
import re
import subprocess
from pathlib import Path
### Keybase proof
I hereby claim:
* I am spirkaa on github.
* I am devmemru (https://keybase.io/devmemru) on keybase.
* I have a public key ASDOfu7_rJ7XFeJ_sVNiTOqoO0SETmTKAVTTWp10sCAO5Ao
To claim this, I am signing this object:
@spirkaa
spirkaa / vlc-dshow-stream.cmd
Last active September 22, 2021 15:04
Скрипт для запуска трансляции с камеры и микрофона в VLC. Диагностика - это фестиваль! Винтовка - это праздник!
:: piv@devmem.ru, 2021. Exclusive for DONM IT Telegram Chat.
:: !!! Сохранять в кодировке OEM 866 (она же CP 866) !!!
:: Запускать от имени админа, если не меняете путь сохранения локального файла
@echo off
:: DO NOT MODIFY THIS SECTION
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
@spirkaa
spirkaa / filters.py
Created July 1, 2020 05:19
django-filter filter_overrides for django.contrib.postgres.search.SearchVectorField
import functools
import operator
import django_filters
from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVectorField
from django.db.models import F, Q
from . import models
class SearchVectorFilter(django_filters.CharFilter):
@spirkaa
spirkaa / remmina_gterminal.sh
Last active April 11, 2020 08:24
Remmina Gnome Terminal - save to /usr/share/remmina/external_tools/remmina_gterminal.sh
#!/usr/bin/sh
. $(dirname $0)/functions.sh
settitle
if [ $ssh_auth == 3 ]; then
    export CURR_SSH_COMMAND="ssh -oStrictHostKeyChecking=no $ssh_proxycommand $username@$server"
else
    export CURR_SSH_COMMAND="sshpass -p $password ssh -oStrictHostKeyChecking=no $ssh_proxycommand $username@$server"
fi
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
// range sliders init
setSlider()
function setSlider() {
var sldr = ['price', 'ru_stock', 's_config', 'capacity', 'weight', 'discharge']
$.each(sldr, function(k, v) {
$("#" + v).slider({});
console.log("#" + v)
});
}