This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| trap_exit() { | |
| if [[ ! -o xtrace ]]; then | |
| rm -rf "$tmp" | |
| fi | |
| } | |
| tmp=$(mktemp -dt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
| } | |
| }) |
-
Go to https://cachedview.com/
-
Navigate to the deleted repo, e.g. https://webcache.googleusercontent.com/search?q=cache:https://github.com/apcera/termtables
-
Copy latest known commit sha1 signature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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]*)/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| > 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 |
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.
Before you use this, please set the variables.