Learn how to convert Word documents to PNG, JPEG, and BMP images in Python: https://blog.aspose.com/2021/11/04/convert-word-to-png-jpg-bmp-in-python/
This file contains 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
Nature's Particle Manager |
Current (2023-03-01) OpenAI Whisper API expects a file uploaded as part of multipart/form-data
in POST request.
I initially struggled to use this API inside Node.js with an audio file stored inside an AWS s3 bucket, so I decided to share this snippet:
The API usage example from the OpenAI docs:
curl --request POST \
--url https://api.openai.com/v1/audio/transcriptions \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: multipart/form-data' \
This file contains 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
<!-- https://medium.com/@bryanjenningz/how-to-record-and-play-audio-in-javascript-faa1b2b3e49b --> | |
<!-- https://docs.aws.amazon.com/en_us/sdk-for-javascript/v2/developer-guide/s3-example-photo-album.html --> | |
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.585.0.min.js"></script> | |
<script> | |
function uploadAWS(blob) { | |
var vaultBucketName = "[YOUR-BUCKET-NAME]"; | |
var bucketRegion = "[YOUR-AWS-REGION]"; | |
var IdentityPoolId = "[YOUR-IDENTITY-POOL-ID]"; |
This file contains 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 http://stackoverflow.com/a/10520017/1307721 and http://stackoverflow.com/a/16022728/1307721 | |
Podium = {}; | |
Podium.keydown = function(k) { | |
var oEvent = document.createEvent('KeyboardEvent'); | |
// Chromium Hack | |
Object.defineProperty(oEvent, 'keyCode', { | |
get : function() { |
This file contains 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
pick 019325e 0.1.0 | |
pick a4b689d Fetch all dependencies | |
squash 714a49d Matches keywords to Docker repos | |
pick d2d1ca3 parseDependencies returns an object of dependencies. | |
squash e3b6cd9 Clean up packageParser | |
squash 57acd67 Initial commit | |
squash 3f3e05e Rough out how we'll make Dockerfiles | |
squash 9e10b94 Can check for, make Docker files | |
squash a27b0ee Write docker files | |
pick a0980b8 Build Dockerfiles |
This file contains 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
function ave(arr) { | |
if (arr && arr.length) { | |
//easy way to get array total is using reduce; c is current | |
const total = arr.reduce((a, c) => { | |
return a + c; | |
}); | |
return total / arr.length; | |
} | |
throw new Error('wrong arr'); | |
}; |
This file contains 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
(function () { | |
var ROOT_URL = "https://canopy.co"; | |
var PRICE_SELECTORS = [ | |
".priceLarge", | |
".a-color-price.a-size-large", | |
".a-color-price.a-size-medium", | |
"#priceblock_ourprice" | |
]; | |
var IMAGE_SELECTORS = [ |
This file contains 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
This means that 1rem equals the font size | |
of the html element (which for most browsers has a default value of 16px). |
This file contains 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
function getWithExpiry(key) { | |
const itemStr = localStorage.getItem(key) | |
// if the item doesn't exist, return null | |
if (!itemStr) { | |
return null | |
} | |
const item = JSON.parse(itemStr) | |
const now = new Date() | |
// compare the expiry time of the item with the current time | |
if (now.getTime() > item.expiry) { |
NewerOlder