Skip to content

Instantly share code, notes, and snippets.

View codeyourwayup's full-sized avatar

FRANK GO codeyourwayup

View GitHub Profile
@Dosant
Dosant / README.md
Last active March 14, 2024 01:39
AWS S3 to OpenAI Whisper via Node.js stream

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' \
@codeyourwayup
codeyourwayup / simulate_keypress.js
Created February 8, 2023 01:49 — forked from ejoubaud/simulate_keypress.js
Simulate keypress that works in Google nav in Chrome
// 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() {
@gmjelle
gmjelle / aliExpressApi.js
Last active September 7, 2023 19:13
Making an API call to the AliExpress Affiliate API. Explains how to sign the request and create the correct hash.
import crypto from "crypto";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
dayjs.extend(utc);
dayjs.extend(timezone);
const API_URL = "http://gw.api.taobao.com/router/rest";
const API_SECRET = "FIND THIS IN THE AE CONSOLE";
@jsoma
jsoma / CORS.xml
Created September 4, 2020 21:08
CORS public access
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
</CORSRule>
</CORSConfiguration>
@liketaurus
liketaurus / recorder.html
Created December 9, 2019 16:16
How to record audio in client code and upload recording to AWS S3 bucket
<!-- 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]";
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/
@juniorbird
juniorbird / git-rebase-todo
Created June 2, 2016 03:02
Sample git rebase todo
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
@ejoubaud
ejoubaud / simulate_keypress.js
Last active April 9, 2024 18:38
Simulate keypress that works in Google nav in Chrome
// 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() {
@hofmannsven
hofmannsven / README.md
Last active July 16, 2024 01:30
Git CLI Cheatsheet