Skip to content

Instantly share code, notes, and snippets.

View Ahwar's full-sized avatar
🏠
Working from home

Muhammad Ahwar Ahwar

🏠
Working from home
View GitHub Profile
@Ahwar
Ahwar / upload files to amazon s3 bucket.py
Last active November 10, 2022 02:50
Upload a single file to amazon s3 bucket. The upload_file method accepts a file name, a bucket name, and an object name. The method handles large files by splitting them into smaller chunks and uploading each chunk in parallel.
import logging
import boto3
from botocore.exceptions import ClientError
import os
"""
Upload a single file to amazon s3 bucket
@Ahwar
Ahwar / run ONNX model inference using onnxruntime.py
Created March 25, 2022 11:50
run ONNX model inference using onnxruntime
import onnxruntime as nxrun
import numpy as np
import time
def mills():
"""function to get current
return int(round(time.time() * 1000))
@Ahwar
Ahwar / Leaflet JS Map - Polygon - Zoom Out Limits.html
Created August 12, 2021 02:14
A Leflet JS map of United States, and polygon is drawn around colorado state, have limit on zooming out
<!DOCTYPE html>
<!-- A Leflet JS map of United States, and polygon is drawn around colorado state, have limit on zooming out -->
<head>
<meta charset="UTF-8">
<meta name="description" content="A Leflet JS map of United States, and polygon is drawn around colorado state, have limit on zooming out created by Muhammad Ahwar https://gist.github.com/Ahwar">
<meta name="keywords" content="HTML, CSS, JavaScript, Leaflet, United States, colorado, polygon ">
<meta name="author" content="Muhammad Ahwar">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
@Ahwar
Ahwar / Google Map - Polygon - Zoom Limits - Marks.html
Last active August 12, 2021 02:11
A google map of United States, and polygon is drawn around colorado state, have limit on zooming it will not zoom out anymore, but will zooming in only five steps, mark three positions
<!DOCTYPE html>
<!-- A google map of United States, and polygon is drawn around colorado state, have limit on zooming out and zooming in,it will not zoom out anymore, but will zooming in only five steps, mark three positions -->
<html>
<head>
<title>Simple google Map</title>
<meta charset="UTF-8">
<meta name="description" content="A google map JS map of United States, and polygon is drawn around colorado state, have limit on zooming out ,it will not zoom out anymore, but will zooming in only five steps, mark three positions created by Muhammad Ahwar https://gist.github.com/Ahwar">
<meta name="keywords" content="HTML, CSS, JavaScript, United States, colorado, polygon ">
<meta name="author" content="Muhammad Ahwar">
@Ahwar
Ahwar / Convert Android ImageProxy to Bitmap in Java.java
Created September 8, 2020 06:32
This Java code converts android's ImageProxy to Bitmap.
private Bitmap toBitmap(Image image) {
Image.Plane[] planes = image.getPlanes();
ByteBuffer yBuffer = planes[0].getBuffer();
ByteBuffer uBuffer = planes[1].getBuffer();
ByteBuffer vBuffer = planes[2].getBuffer();
int ySize = yBuffer.remaining();
int uSize = uBuffer.remaining();
int vSize = vBuffer.remaining();