Skip to content

Instantly share code, notes, and snippets.

View vodolaz095's full-sized avatar

Остроумов Анатолий vodolaz095

View GitHub Profile
@vodolaz095
vodolaz095 / check_email.sh
Created December 18, 2024 21:11
check for new email by curl via imap
#!/usr/bin/env bash
auth="username:password"
host=imaps://imap.example.org
curl -u $auth $host -X 'LIST "" "*"'
curl -u $auth $host -X 'STATUS INBOX (MESSAGES)'
@vodolaz095
vodolaz095 / connect_work.sh
Created December 17, 2024 06:11
Script for starting Network Manager VPN connection with password stored in secret-tool \ seahorse in linux
#!/usr/bin/env bash
work_pwd=`secret-tool lookup user vodolaz095 domain example.org`
(
sleep 1
echo "vodolaz095"
sleep 1
echo "$work_pwd"
) | nmcli connection up work --ask
@vodolaz095
vodolaz095 / findChampion.go
Created November 9, 2024 10:07
Подсчёт шагов
package count_steps
/*
Необходимо определить userIds участников, которые прошли наибольшее количество шагов steps за все дни, не пропустив ни одного дня соревнований.
Пример
# Пример 1
# ввод
statistics = [
@vodolaz095
vodolaz095 / backup_valheim.sh
Created September 21, 2024 17:23
Backup Valheim user data on linux
#!/usr/bin/env bash
# This script makes local copy of all Valheim user's data
set -e
fname=`date "+%Y_%m_%d___%H_%M_%S"`
fpath="$HOME/Documents/backups/valheim/valheim_$fname.zip"
echo "Preparing to make backup into $fpath..."
@vodolaz095
vodolaz095 / strings_test.go
Last active June 26, 2022 21:29
golang benchmark of string concatenation
package strings
import (
"bytes"
"fmt"
"os"
"strings"
"testing"
)
@vodolaz095
vodolaz095 / install.sh
Created December 15, 2018 13:47
basicFedoraSetup4Development.sh
#!/usr/bin/env bash
# upgrade system
su -c 'dnf upgrade -y'
# install extra repos
su -c 'dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm'
su -c 'dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'
su -c 'dnf upgrade -y rpmfusion-free-release rpmfusion-nonfree-release'
@vodolaz095
vodolaz095 / screenshot
Created November 18, 2018 08:02
screenshot - shell script to make and upload screenshot
#!/bin/bash
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 9 | head -n 1)
PIC_URL=$HOME/Pictures/Screenshots/$NEW_UUID.png
mkdir -p $HOME/Pictures/Screenshots
scrot -s -c $PIC_URL
scp $PIC_URL holod.local:/srv/www/s/
+ check_common_commands http://example.com
+ '[' 1 -gt 0 ']'
+ parm=http://example.com
+ shift
+ case "$parm" in
+ '[' 0 -gt 0 ']'
+ '[' -z '' ']'
+ unset XDG_UTILS_DEBUG_LEVEL
+ '[' 0 -lt 1 ']'
+ xdg_redirect_output=' > /dev/null 2> /dev/null'
@vodolaz095
vodolaz095 / main.go
Created May 20, 2017 11:17
Example of how to host telegram bot on heroky
package main
import (
"gopkg.in/telegram-bot-api.v4"
"log"
"net/http"
"os"
)
func main() {
@vodolaz095
vodolaz095 / guimessage.sh
Created December 4, 2016 09:58
Send message to users desctop using notify-send from remote console via SSH
#!/bin/bash
DISPLAY=:0.0 /bin/notify-send "$1"