-
Structure & Flow:
Your code follows a common Cloudflare Workers pattern:- An event listener intercepts fetch events.
- The
handleRequest()
function rewrites the incoming URL, creates a new request with modified headers, forwards it to the target server, and then post-processes the response (rewriting redirects, CORS, cookies, and even HTML content).
-
HTML Rewriting:
You’re using Cloudflare’sHTMLRewriter
to adjust links (a[href]
), images (img[src]
), and form actions (form[action]
). This is a good approach for making proxied HTML interactive through your proxy.
Key Observations:
- The code implements a basic reverse proxy that:
- Routes requests through a specific domain (stratosphericus.workers.dev)
- Rewrites URLs in HTML responses
- Handles CORS
- Manages cookies
- Supports redirects
Potential Issues & Improvements:
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
const fs = require('fs'); | |
// ToDo: Update these values if needed | |
const CONVERSATIONS_FILE_PATH = './conversations.json'; // From your chatGPT data export | |
const CHARACTERS_PER_TOKEN = 4; | |
const PRICING_DOLLARS_PER_MILLION_TOKENS = { | |
input: 2.50, | |
output: 10 | |
}; |
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
// ==UserScript== | |
// @name Suno Aligned Words Fetcher with Auth | |
// @namespace http://tampermonkey.net/ | |
// @version 1.2 | |
// @description Fetch aligned words with auth and add a button under the image on Suno pages. | |
// @author Your Name | |
// @match https://suno.com/song/* | |
// @grant none | |
// ==/UserScript== |
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
const { | |
DuckDBBitValue, | |
DuckDBBlobValue, DuckDBDateValue, DuckDBDecimalValue, | |
DuckDBIntervalValue, DuckDBListType, | |
DuckDBListValue, DuckDBMapType, | |
DuckDBMapValue, DuckDBStructType, | |
DuckDBStructValue, | |
DuckDBTimestampMillisecondsValue, | |
DuckDBTimestampNanosecondsValue, | |
DuckDBTimestampSecondsValue, |
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
import axios from 'axios' | |
import {createArrayCsvWriter as createCsvWriter} from 'csv-writer' | |
// Add your consumer key and access token. | |
const pocketConsumerKey = ''; | |
const pocketAccessToken = ''; | |
const pocketItemsFilePath = './pocket_items.csv'; | |
const axiosConfig = { | |
'headers': { |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"strconv" | |
"time" | |
) | |
func printMemStats(message string, rtm runtime.MemStats){ |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func testMakeSlice(numIterations int, numRuns int){ | |
a := make([]int32, 0) | |
for k := 0; k < numRuns; k++ { |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
var s string = "h👍🏻e" | |
for i, c := range []rune(s) { | |
fmt.Println(i, string(c)) |
NewerOlder