Skip to content

Instantly share code, notes, and snippets.

View shubhampatel94's full-sized avatar
🎯
Focusing

Shubham Patel shubhampatel94

🎯
Focusing
View GitHub Profile
@shubhampatel94
shubhampatel94 / paramiko_socks.py
Last active July 24, 2021 08:54
Using socks proxy with Paramiko
# clone https://github.com/yomagroup/paramiko/tree/add-socks-proxy
# checkout to the branch add-socks-proxy `git checkout add-socks-proxy`
# Build python package, python setup.py bdist-wheel
# Install newly build package `pip install --force-reinstall dist/paramiko-2.7.2-py2.py3-none-any.whl`
#Usage
import paramiko
import requests
ssh_client = paramiko.SSHClient()
@shubhampatel94
shubhampatel94 / timechange.py
Last active September 9, 2022 11:59
Convert UTC nginx time to EST nginx time format
# python 3 code.
from datetime import datetime
import pytz
#b -> rep 3 char month format.
# expected timeformat "07/Jun/2021:22:59:31 +0000"
def convert_input_time_to_est_zone(time_entry):
time_entry = datetime.strptime(time_entry, "%d/%b/%Y:%H:%M:%S %z")
new_timezone_format = pytz.timezone('US/Eastern')
est_formated_time = time_entry.astimezone(new_timezone_format).strftime("%d/%b/%Y:%H:%M:%S %z")