Skip to content

Instantly share code, notes, and snippets.

View iRhonin's full-sized avatar
🌱

Arash Fatahzade iRhonin

🌱
  • Nobitex
View GitHub Profile
@iRhonin
iRhonin / disable-caps.sh
Last active July 20, 2018 12:37
Disable Caps Lock key
dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:escape']"
@iRhonin
iRhonin / cp.py
Created July 20, 2018 12:35
Tiny cp command with -r option in python 3.6
#! /usr/local/bin/python3.7
import sys
import argparse
from pathlib import Path
from os import path, makedirs
def read_file(file_path, chunksize=8192):
with open(file_path, mode='rb') as f:
@iRhonin
iRhonin / ssh-proxy.service
Created January 5, 2019 07:11
Unit file for ssh proxy
[Unit]
Description=nl SSH proxy service
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/ssh -D 1234 -C -N -F %h/.ssh/config vps-nl -o ServerAliveInterval=1
ExecReload=/bin/kill -s HUP
ExecStop=/bin/kill -s TERM
Type=idle
@iRhonin
iRhonin / ssh-proxy.service
Created January 5, 2019 07:11
Unit file for ssh proxy
[Unit]
Description=nl SSH proxy service
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/ssh -D 1234 -C -N -F %h/.ssh/config vps-nl -o ServerAliveInterval=1
ExecReload=/bin/kill -s HUP
ExecStop=/bin/kill -s TERM
Type=idle
@iRhonin
iRhonin / reformat_imports.md
Last active January 5, 2019 14:03
Single command to use zimports on a directory

Run this command on your directory to reformat imports on a directory:

find . -iname '*.py' | tr '\n' ' '  | zimports `find . -iname '*.py' | tr '\n' ' ' ` -i

zimports.

@iRhonin
iRhonin / download_from_file.sh
Last active February 5, 2019 08:26
Download from file contains list of urls
echo "function download_from_file() {
while IFS='' read -r line || [[ -n \$line ]];
do axel \$line \${@:2}
done < \$1
}" >> ~/.bashrc
source ~/.bashrc
@iRhonin
iRhonin / setup-python3.6
Last active February 8, 2019 00:19
Setup Python3.6 Ubuntu 16 & 18
sudo apt-get install python3-dev
curl https://bootstrap.pypa.io/get-pip.py | sudo -H python3.6
sudo -H pip3.6 install virtualenvwrapper
echo "export VIRTUALENVWRAPPER_PYTHON=`which python3.6`" >> ~/.bashrc
echo "source $(which virtualenvwrapper.sh)" >> ~/.bashrc
source ~/.bashrc
docker run -it -e SS_PASSWORD={your_password_here} -e SS_METHOD= -p 1144:8388 leizongmin/shadowsocks:latest
@iRhonin
iRhonin / client-wg0.conf
Last active April 16, 2020 16:01
wireguard
[Interface]
PrivateKey = ...
Address = 192.168.111.2
[Peer]
PublicKey = ...
AllowedIPs = 0.0.0.0/0
Endpoint = <external-ip>:443
PersistentKeepalive = 19
@iRhonin
iRhonin / backup.sh
Created June 3, 2020 09:36
Auto Reconnect Rsync
#!/bin/bash
echo -e "Please enter the full (escaped) file path:"
read -r path
echo "Path: $path"
echo -e "Enter the destination:"
read -r dst
echo "Destination: $dst"
while [ 1 ]
do
rsync --progress --partial --delete -az -e ssh "USER@HOST:$path" $dst