Skip to content

Instantly share code, notes, and snippets.

@lessavin
lessavin / braille_binary_clock.c
Last active April 25, 2023 23:28
Hexadecimal number to braille pattern conventer. Binary clock. Now on C!
/**
* @file braille_binary_clock.c
*
* Hexadecimal number to braille pattern conventer. Binary clock.
*
* Created: 2023-04-26
* Updated: *never*
*
* @author Alexey Savin (LamberKeep)
*/
@lessavin
lessavin / timetoemoji.py
Last active December 10, 2022 17:37
Time to an emoji clock symbol conventer.
# by LamberKeep @ December 2022
import time
class TimeToEmoji:
def time2emoji(h: int, m: int):
"""Converts the time to an emoji clock symbol.
:param int h: Hours in 24-hour time format.
:param int m: Minutes.
@lessavin
lessavin / nwn_server.sh
Last active September 29, 2023 06:15
Neverwinter Nights 1 - simple server launcher
#!/bin/sh
# Neverwinter Nights 1 - simple server launcher
#
# Created: 2023.05.24
# Updated: 2023.06.21
#
# Author: Alexey Savin (LamberKeep)
# CONFIGURATION
@lessavin
lessavin / ssh_manager.sh
Last active August 24, 2023 06:05
Simple SSH/SFTP manager
#!/bin/sh
# Simple SSH/SFTP manager
#
# Created: 2023.05.23
# Updated: 2023.08.24
#
# Author: Alexey Savin (LamberKeep)
# To run connection manager just run this file.
@lessavin
lessavin / servers_controller_cli.sh
Last active September 25, 2023 16:29
Servers Controller CLI
#!/bin/sh
# Configurations.
serviceDirectory="/usr/lib/systemd/system"
# Constants (do not touch).
menuServiceOptions="return status start stop restart enable disable exit"
menuGlobalOptions=$(ls $serviceDirectory)
@lessavin
lessavin / terraria.service
Last active December 24, 2023 22:40 — forked from djagya/terraria.service
Terraria server in screen systemd service
# /home/steam/.config/systemd/user/Terraria.service
[Unit]
Description=Server daemon for Terraria
After=network.target
[Service]
WorkingDirectory=/home/steam/Steam/steamapps/common/Terraria
Restart=always
@lessavin
lessavin / pyzamrename.sh
Last active June 8, 2024 16:59
Renames files according pyzam result
#!/bin/bash
# pyzamrename.sh
# Renames files according pyzam result
set -e
input=$(pyzam --input "$@")
artist=$(echo "$input" | grep 'Artist:' | cut -d ':' -f 2 | cut -c 2-)
if [ -z "$artist" ]; then
@lessavin
lessavin / ssh2rcon.sh
Created June 28, 2024 20:35
Minecraft RCON connection via SSH.
# RCON is BAD, don't open this port! There no security for your server!
# Instead of this, use SSH:
# 1. Install on the server mcrcon by Tiiffi (https://github.com/Tiiffi/mcrcon).
# 2. Set environment variables as $MCRCON_HOST, $MCRCON_PORT and $MCRCON_PASS.
# 3. Use next script...
ssh $MCRCON_HOST mcrcon -H localhost -P $MCRCON_PORT -p $MCRCON_PASS $@
# You also can create command alias in .bashrc:
alias ssh2rcon='ssh $MCRCON_HOST mcrcon -H localhost -P $MCRCON_PORT -p $MCRCON_PASS'
@lessavin
lessavin / minecraft-server.service
Last active July 27, 2025 16:55
Systemd service for Minecraft server.
[Unit]
Description=Minecraft Server
[Service]
WorkingDirectory=/srv/minecraft-server
User=minecraft-server
Group=minecraft-server
UMask=007
Restart=on-failure
RestartSec=60
@lessavin
lessavin / natcheck.sh
Last active November 18, 2025 21:35
Returns 1 if ISP put you under NAT.
#!/usr/bin/sh
# natcheck.sh
# Returns 1 if ISP put you under NAT.
# Source: https://superuser.com/questions/1630106/how-do-i-find-out-if-my-isp-has-put-me-behind-a-nat-will-dynamic-dns-work-with
NATCHECK_HOPS=2 # Change this value to <rounter_number>+1.
if [ $NATCHECK_HOPS -lt $(traceroute $(curl -s ifconfig.me) | grep ms | wc -l) ]
then