Skip to content

Instantly share code, notes, and snippets.

View iRhonin's full-sized avatar
🌱

Arash Fatahzade iRhonin

🌱
  • Nobitex
View GitHub Profile
@iRhonin
iRhonin / set-apt-proxy.md
Created September 17, 2022 17:16 — forked from wonderbeyond/set-apt-proxy.md
[ubuntu][socks5][proxy] Set proxy for apt

Writing an apt proxy conf file /etc/apt/apt.conf.d/proxy.conf as below.

Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
Acquire::socks::Proxy "socks5h://127.0.0.1:1080";

And the proxy settings will be applied the next time we run apt.

@iRhonin
iRhonin / pydantic_password_field.py
Last active September 16, 2022 14:54
Pydantic Password Field
from typing import Any
from typing import Dict
from typing import Set
from typing import Type
from pydantic import SecretStr
from pydantic.utils import update_not_none
class Password(SecretStr):
@iRhonin
iRhonin / pydantic_phone_number_field.py
Last active February 6, 2023 17:38
Pydantic Phone Number Field
import phonenumbers
from pydantic.validators import strict_str_validator
class PhoneNumber(str):
"""Phone Number Pydantic type, using google's phonenumbers"""
@classmethod
def __get_validators__(cls):
yield strict_str_validator
yield cls.validate
This file has been truncated, but you can view the full file.
[?2004h
Node name (default=entertaining-farmer):
[?2004l
[2020-12-16T18:28:34Z ERROR golemsp] Interrupted
[2020-12-16T18:29:22Z INFO yagna] Using data dir: "/home/rhonin2/.local/share/yagna"
[2020-12-16T18:29:22Z INFO yagna] Starting yagna service! Version: 0.5.0 (d33058bb 2020-12-01 build #96).
[2020-12-16T18:29:22Z INFO ya_sb_router] Router listening on: 127.0.0.1:7464
[2020-12-16T18:29:22Z INFO ya_persistence::executor] using database at: /home/rhonin2/.local/share/yagna/yagna.db
[2020-12-16T18:29:22Z INFO ya_persistence::executor] using database at: /home/rhonin2/.local/share/yagna/market.db
[2020-12-16T18:29:22Z INFO ya_persistence::executor] using database at: /home/rhonin2/.local/share/yagna/activity.db
@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
@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
docker run -it -e SS_PASSWORD={your_password_here} -e SS_METHOD= -p 1144:8388 leizongmin/shadowsocks:latest
@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
@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 / 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.