Skip to content

Instantly share code, notes, and snippets.

View yuchdev's full-sized avatar
💭
Open for new opportunities

Yurii Cherkasov yuchdev

💭
Open for new opportunities
  • Open for new opportunities
  • Nibiru
View GitHub Profile
@yuchdev
yuchdev / git_mirror_repo.bat
Last active November 27, 2019 05:23
Git mirror repository
$ git clone --mirror https://github.com/yuchdev/entropy_calculator.git
$ cd entropy_calculator.git
$ git push --mirror https://bitbucket.org/ycherkasov/entropy_calculator.git
@yuchdev
yuchdev / git_two_remotes.bat
Last active November 27, 2019 05:24
Git adding two remotes for single push
git remote set-url --add --push origin https://github.com/yuchdev/entropy_calculator.git
git remote set-url --add --push origin https://bitbucket.org/ycherkasov/entropy_calculator.git
@yuchdev
yuchdev / examples.sh
Last active January 7, 2020 07:47
Bash examples
#!/bin/sh
# Execute for every subdir
for dir in ~/projects/git/*
do
(cd $dir && git pull)
done
Find text
find / -type f -exec grep -H 'text-to-find-here' {} \;
@yuchdev
yuchdev / check_filesystem.sh
Last active January 7, 2020 09:58
Linux: Check Filesystem & Save results
sudo fsck -fvy /dev/sdb5 | tee ~/sdb5_results
# try -fvn
@yuchdev
yuchdev / geeklet-sysmon.sh
Last active January 7, 2020 09:59
Mac: geeklet for Mac Geektool for displaying system information on the desktop
#!/bin/bash
# Make sure you change the following variable
# to match the network interface you would like to monitor
nic=en0
echo "CPU information:"
sysctl -n machdep.cpu.brand_string
# Find current bandwith in each pipe
@yuchdev
yuchdev / password_ssh.sh
Last active January 7, 2020 10:52
Password autorization via SSH utility
sudo apt-get install sshpass
# $1: 1st command-line param, password
# $2: 2nd command-line param, username
# $3: 3rd command-line param, rsync source path
# $4: 4th command-line param, rsync destination path
/usr/bin/rsync -ratlz --rsh="/usr/bin/sshpass -p $1 ssh -o StrictHostKeyChecking=no -l $2" $3 $4
# Alternatively, you can avoid the password prompt on rsync command
@yuchdev
yuchdev / easy_benshmark.sh
Created March 31, 2020 16:14
Easy way to create benchmark for basically any application
time python3 jira_backup.py
# Output
# real 0m1.542s
# user 0m0.299s
# sys 0m0.136s
@yuchdev
yuchdev / shell_command.py
Created June 10, 2021 17:36
Command os.system with ability to enter and leave directory using 'with' statement
class Shell:
def __init__(self, cd_path):
self.cd_path = cd_path
self.exit_path = os.getcwd()
def __enter__(self):
os.chdir(self.cd_path)
def __exit__(self):
@yuchdev
yuchdev / dd_progress.sh
Last active September 23, 2021 12:17
Linux: dd with progress
#!/bin/bash
# Method 1
dd if=/dev/urandom of=/dev/null status=progress
# Method 2
# You just need to enter a controlT character from the keyboard while the dd command is executing.
# By pressing the controlT character, you are sending the same SIGINFO signal to the dd command
# that the command pkill -INFO -x dd sends.
@yuchdev
yuchdev / random_protonvpn.py
Last active March 18, 2022 08:03
Choose random ProtonVPN server
import os
import sys
import time
import random
import argparse
# Key is country code, value is the number of servers to use
SERVER_LIST = {
"AR": [*range(1, 8)],
"AU": [*range(13, 44)],