mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
init
This commit is contained in:
31
scripts/check-analytics.js
Normal file
31
scripts/check-analytics.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const TOKEN = "";
|
||||
const ACCOUNT_ID = "";
|
||||
|
||||
async function showTables() {
|
||||
const url = `https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/analytics_engine/sql`;
|
||||
|
||||
const options = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${TOKEN}`,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
body: "SHOW TABLES",
|
||||
};
|
||||
|
||||
try {
|
||||
console.log("Sending request to Cloudflare Analytics Engine...");
|
||||
const response = await fetch(url, options);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Response received:", JSON.stringify(data, null, 2));
|
||||
} catch (error) {
|
||||
console.error("Error occurred:", error.message);
|
||||
}
|
||||
}
|
||||
|
||||
showTables();
|
30
scripts/gen_sitemap.js
Executable file
30
scripts/gen_sitemap.js
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import fs from "fs";
|
||||
|
||||
const currentDate = new Date().toISOString().split("T")[0];
|
||||
|
||||
const sitemapTemplate = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 ">
|
||||
<url>
|
||||
<loc>https://geoff.seemueller.io/</loc>
|
||||
<lastmod>${currentDate}</lastmod>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://geoff.seemueller.io/connect</loc>
|
||||
<lastmod>${currentDate}</lastmod>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
</urlset>`;
|
||||
|
||||
const sitemapPath = "./public/sitemap.xml";
|
||||
|
||||
fs.writeFile(sitemapPath, sitemapTemplate, (err) => {
|
||||
if (err) {
|
||||
console.error("Error writing sitemap file:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("Sitemap updated successfully with current date:", currentDate);
|
||||
});
|
22
scripts/get_groq_models.js
Normal file
22
scripts/get_groq_models.js
Normal file
@@ -0,0 +1,22 @@
|
||||
(async () => {
|
||||
// Run the script with bun so it automatically picks up the env
|
||||
const apiKey = process.env.GROQ_API_KEY;
|
||||
|
||||
try {
|
||||
const response = await fetch("https://api.groq.com/openai/v1/models", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log(JSON.stringify(data));
|
||||
} catch (error) {
|
||||
console.error("Error fetching data:", error);
|
||||
}
|
||||
})();
|
36
scripts/killport.js
Normal file
36
scripts/killport.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as child_process from "node:child_process";
|
||||
|
||||
export const killProcessOnPort = (port) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
child_process.exec(`lsof -t -i :${port}`.trim(), (err, stdout) => {
|
||||
if (err) {
|
||||
if (err.code !== 1) {
|
||||
console.error(`Error finding process on port ${port}:`, err);
|
||||
return reject(err);
|
||||
} else {
|
||||
console.log(`No process found on port ${port}`);
|
||||
return resolve();
|
||||
}
|
||||
}
|
||||
|
||||
const pid = stdout.trim();
|
||||
if (!pid) {
|
||||
console.log(`No process is currently running on port ${port}`);
|
||||
return resolve();
|
||||
}
|
||||
|
||||
child_process.exec(`kill -9 ${pid}`.trim(), (killErr) => {
|
||||
if (killErr) {
|
||||
console.error(
|
||||
`Failed to kill process ${pid} on port ${port}`,
|
||||
killErr,
|
||||
);
|
||||
return reject(killErr);
|
||||
}
|
||||
|
||||
console.log(`Successfully killed process ${pid} on port ${port}`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
3
scripts/update_vpn_blocklist.sh
Executable file
3
scripts/update_vpn_blocklist.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
gh workflow run "Update VPN Blocklist"
|
Reference in New Issue
Block a user