Skip to content

Instantly share code, notes, and snippets.

View alsolovyev's full-sized avatar
💭
Enjoy life, Eat well & Laugh often ¯\_(ツ)_/¯

Solovyev Aleksey alsolovyev

💭
Enjoy life, Eat well & Laugh often ¯\_(ツ)_/¯
View GitHub Profile
@alsolovyev
alsolovyev / rt.fish
Last active September 9, 2024 06:09
This Fish shell script simplifies the process of recording Twitch streams by using Streamlink
function rt --description "Record a Twitch stream to a specified file."
set -l app "streamlink"
# Ensure the app is installed
if not command -v $app > /dev/null
echo (set_color red)"Error: '$app' is not installed."(set_color normal)
switch $app
case "streamlink"
if command -v brew > /dev/null
@alsolovyev
alsolovyev / wifi.fish
Last active June 30, 2024 11:43
Managing the state of Wi-Fi interfaces via ssh on MikroTik routers running RouterOS
#
# Remark:
# The USERNAME, HOST, PORT, SSH_KEY_PATH variables must be filled in before use
#
# Usage:
# - wifi Guest status
# - wifi Guest on
# - wifi Guest off
# - wifi Guest toggle
# - wifi Guest
@alsolovyev
alsolovyev / tmux.conf
Last active July 11, 2024 17:43
Tmux configuration
# https://man7.org/linux/man-pages/man1/tmux.1.html
# Common
set -g base-index 1
set -g mode-keys vi
set -g mouse on
set -g pane-base-index 1
set -g status off
set -g status-interval 0
@alsolovyev
alsolovyev / sendToTelegram.fish
Last active March 15, 2024 17:23
Bash and Fish scripts to send messages (videos, photos, audio, documents, or plain text) to a Telegram chat.
function sendToTelegram -d "Send a message or document to a telegram chat"
#
# Description: This script allows you to send text messages or files (images,
# videos, audio, or documents) to a Telegram chat using a Telegram bot.
# Ensure you set the TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables.
# For more information on creating a Telegram bot, visit: https://t.me/BotFather
#
# Note: Maximum file size allowed is 50 MB.
#
# Usage:
@alsolovyev
alsolovyev / createTask.bat
Created February 22, 2024 12:06
Execute a script (batch, powershell, etc) in hidden mode every N minutes using the Windows 10/11 Task Scheduler
@echo off
rem After triggered, repeat every 10 minutes indefinitely
schtasks /create /tn "My task name" /tr "wscript.exe C:\task.vbs" /sc minute /mo 10
@alsolovyev
alsolovyev / Nvim.app
Last active February 21, 2024 12:32
A script to open a file in nvim by right-clicking on it
on run {input}
if (count of input) > 0 then
set {filePath, fileName} to getPathAndName from input
set cmdCd to "cd " & quoted form of filePath
set cmdNvim to "nvim " & quoted form of fileName
tell application "iTerm"
if exists window 1 then
tell current window
create tab with default profile
@alsolovyev
alsolovyev / starship.toml
Last active February 19, 2024 17:00
Configuration file for starship prompt with catppuccin (mocha) color scheme
"$schema"="https://starship.rs/config-schema.json"
format = """
$python\
$username\
$hostname\
$directory\
$git_branch\
$git_commit\
$git_state\
@alsolovyev
alsolovyev / FileRenamer.bat
Last active November 14, 2023 14:12
Batch script to rename files in a specified directory based on a user-defined template.
:: Batch Script: FileRenamer.bat
::
:: Description:
:: This batch script renames files in a specified directory based on a user-defined template.
:: It allows customization of the renaming process by providing options for directory,
:: template, file pattern, delimiter, and starting index.
::
:: Usage:
:: FileRenamer.bat [-d <directory>] [-t <template>] [-p <pattern>] [-del <delimiter>] [-i <index>]
::
@alsolovyev
alsolovyev / info.bat
Created March 30, 2023 13:01
Get Memory and CPU Usage in Windows 10 via Batch (cmd)
@echo off
setlocal
for /f "tokens=2 delims=:" %%a in ('systeminfo ^| find "Available Physical Memory"') do set "avail_mem=%%a"
if %errorlevel% neq 0 (
echo Error: Failed to get available physical memory
) else (
echo Available memory: %avail_mem%
)
@alsolovyev
alsolovyev / vim.applescript
Created September 10, 2022 20:08
Raycast script to open Vim or files in Vim
#!/usr/bin/osascript
# Dependency: requires iTerm (https://iterm2.com)
# Install via Homebrew: `brew install --cask iterm2`
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Open Vim
# @raycast.mode compact