Skip to content

Instantly share code, notes, and snippets.

View mayank160920's full-sized avatar

Mayank mayank160920

View GitHub Profile
@mayank160920
mayank160920 / install.sh
Created January 8, 2023 17:02 — forked from wheatdog/install.sh
Install rclone without root
#!/usr/bin/env bash
trap_exit() {
if [[ ! -o xtrace ]]; then
rm -rf "$tmp"
fi
}
tmp=$(mktemp -dt)
async function handleRequest(request) {
var inputUrl = request.url.replace("https://meta.motyar.workers.dev/", "")
// return error if the url is not passed
if(!inputUrl){
return new Response(JSON.stringify({"error":"Input URL missing! Pass it like https://meta.motyar.workers.dev/example.com"}), {
headers: {
"content-type": "application/json;charset=UTF-8"
}
})
@mayank160920
mayank160920 / how-to-find-forks-of-deleted-repo.md
Created July 31, 2022 11:39 — forked from rjeczalik/how-to-find-forks-of-deleted-repo.md
How to find forks of a deleted repository?
@mayank160920
mayank160920 / download-file.js
Created December 21, 2020 16:15 — forked from zynick/download-file.js
download file ('save as') using javascript xhr
// http://stackoverflow.com/a/23797348/1150427
xhr.open('POST', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
if (this.status === 200) {
var filename = "";
var disposition = xhr.getResponseHeader('Content-Disposition');
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
@mayank160920
mayank160920 / asyncio_executors_threads_procs.py
Created December 9, 2020 05:12 — forked from jmbjorndalen/asyncio_executors_threads_procs.py
Combining Python 3 asyncio coroutines with thread pool and process pool executors
#!/usr/bin/env python3
# Combining coroutines running in an asyncio event loop with
# blocking tasks in thread pool and process pool executors.
#
# Based on https://pymotw.com/3/asyncio/executors.html, but this version runs both
# threads and processes at the same time and interleaves them with asyncio coroutines.
#
# All appears to be working.
#
@mayank160920
mayank160920 / FastTelethon.py
Created December 6, 2020 05:24 — forked from painor/FastTelethon.py
This will increase the download/upload speed when using telethon
"""
> Based on parallel_file_transfer.py from mautrix-telegram, with permission to distribute under the MIT license
> Copyright (C) 2019 Tulir Asokan - https://github.com/tulir/mautrix-telegram
"""
import asyncio
import hashlib
import inspect
import logging
import os
from collections import defaultdict
@mayank160920
mayank160920 / submit.md
Created December 6, 2020 04:44 — forked from tanaikech/submit.md
Simple Script of Resumable Upload with Google Drive API for Python

Simple Script of Resumable Upload with Google Drive API for Python

This is a simple sample script for achieving the resumable upload to Google Drive using Python. In order to achieve the resumable upload, at first, it is required to retrieve the location, which is the endpoint of upload. The location is included in the response headers. After the location was retrieved, the file can be uploaded to the location URL.

In this sample, a PNG file is uploaded with the resumable upload using a single chunk.

Sample script

Before you use this, please set the variables.