Skip to content

Instantly share code, notes, and snippets.

View SohaibAnwaar's full-sized avatar
:octocat:
Always Up to Help you , Reach me out

Master X SohaibAnwaar

:octocat:
Always Up to Help you , Reach me out
View GitHub Profile
Solution :
you have to add you ssh key in your git-hub profile. Follow steps to solve this problem
1. Right Click Folder you want to push in git
2. Select git-bash here problem
3. Write command ssh-keygen by this command your key is generated
4. Copy the key from cmd or go to (C:/User/your_user/.ssh/)
5. open id.rsa with notepad.
6. Copy your key
7. Now go to your git-hub profile
@SohaibAnwaar
SohaibAnwaar / install_nvidia_driver.md
Created September 22, 2021 18:08 — forked from espoirMur/install_nvidia_driver.md
How I fix this issue NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running

I had many driver installed I my virtual machine , so It was actually the reason why I was having the error.

To fix it I had first to remove all driver I have installed before using :

  • sudo apt-get purge nvidia-*
  • sudo apt-get update -sudo apt-get autoremove

After that I when a head and installed the latest version of it nvidia driver:

I did :

#!/usr/bin/env python
# coding: utf-8
# Here's a small python task for you to solve. These are the instructions to write your code. Feel free to use google, but please be prepared to discuss the solution with me:
#
# By running your code, the input file my-test-data.json will be read
# and then ask the user to insert a sku code in order to find its closest similar skus.
#
# It will check for irregularities in the format of the inserted sku code and throw an exception if one was found.
#
@SohaibAnwaar
SohaibAnwaar / retrive_emails.py
Last active June 20, 2022 02:11
Retrive You mails from your mailbox automatically
import email
import imaplib
EMAIL = 'sohaib.anwar@******.com'
PASSWORD = '*********'
SERVER = 'imap.gmail.com'
# connect to the server and go to its inbox
mail = imaplib.IMAP4_SSL(SERVER)
mail.login(EMAIL, PASSWORD)
@SohaibAnwaar
SohaibAnwaar / gist:85ecc4b29f2df4b40feef4b8b71415b9
Last active September 30, 2022 11:50
Upload Image to public bucket aws s3
import boto3
from botocore.exceptions import NoCredentialsError
import requests
import mimetypes
import time
import random
AWS_STORAGE_BUCKET_NAME = "*********************"
AWS_S3_ACCESS_KEY_ID = "****************"
@SohaibAnwaar
SohaibAnwaar / Upload_images_to_private_s3_bucket .py
Last active July 25, 2022 15:58
Upload images to private s3 bucket
import boto3
from botocore.exceptions import NoCredentialsError
import requests
import mimetypes
import time
import random
AWS_STORAGE_BUCKET_NAME = "backend-s3-assets"
AWS_S3_ACCESS_KEY_ID = "*********"
AWS_S3_SECRET_ACCESS_KEY = "************************************"
@SohaibAnwaar
SohaibAnwaar / logger.py
Created June 24, 2022 03:25
Logging in python
import datetime
import logging
class Logger:
def setup_logger(self, name, log_file, level=logging.INFO):
"""To setup as many loggers as you want"""
formatter = logging.Formatter(
'%(asctime)s %(name)s - %(levelname)s - %(message)s')
#!/bin/bash
## This gist contains instructions about cuda v11.2 and cudnn 8.1 installation in Ubuntu 18.04 for PyTorch
#############################################################################################
##### forked by : https://gist.github.com/Mahedi-61/2a2f1579d4271717d421065168ce6a73 ########
#############################################################################################
### steps ####
# verify the system has a cuda-capable gpu
@SohaibAnwaar
SohaibAnwaar / reveive_image_api.py
Created July 13, 2022 14:14
Python - Send bytes Images to apis (Image to string) -> (String to image)
###################################################################################
#
# Decode Image and use in your API
#
#
###################################################################################
def string_to_ndarray(image_str: str) -> np.ndarray:
@SohaibAnwaar
SohaibAnwaar / chrome_headless.py
Created July 15, 2022 11:22 — forked from haranjackson/chrome_headless.py
Deploys the Python Selenium library and Chrome Headless to an AWS Lambda layer. You can specify the region, library version, and runtime. An example Lambda function is given.
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = '/opt/headless-chromium'
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--start-maximized')
options.add_argument('--start-fullscreen')