var http = require('http');
// The following 4 are the actual values that pertain to your account and this specific metric.
var apiKey = '50bd0b6abb354a97bf3256c3e6439060';
var pageId = 'rv39vdb0xws9';
var metricId = 'pgq8vmhnmqzl';
var apiBase = 'https://api.statuspage.io/v1';
var url = apiBase + '/pages/' + pageId + '/metrics/' + metricId + '/data.json';
var authHeader = { 'Authorization': 'OAuth ' + apiKey };
var options = { method: 'POST', headers: authHeader };
// Need at least 1 data point for every 5 minutes.
// Submit random data for the whole day.
var totalPoints = 60 / 5 * 24;
var epochInSeconds = Math.floor(new Date() / 1000);
// This function gets called every second.
function submit(count) {
count = count + 1;
if(count > totalPoints) return;
var currentTimestamp = epochInSeconds - (count - 1) * 5 * 60;
var randomValue = Math.floor(Math.random() * 1000);
var data = {
timestamp: currentTimestamp,
value: randomValue,
};
var request = http.request(url, options, function (res) {
if (res.statusMessage === "Unauthorized") {
const genericError =
"Error encountered. Please ensure that your page code and authorization key are correct.";
return console.error(genericError);
}
res.on("data", function () {
console.log("Submitted point " + count + " of " + totalPoints);
});
res.on("end", function () {
setTimeout(function () {
submit(count);
}, 1000);
});
res.on("error", (error) => {
console.error(`Error caught: ${error.message}`);
});
});
request.end(JSON.stringify({ data: data }));
}
// Initial call to start submitting data.
submit(0);
var admin = require("firebase-admin");
var serviceAccount = require("path/to/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
npm i --save genkit @genkit-ai/googleai
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=AIzaSyBh8TMadCkryj17qwhVQfwv7BA5bAMyVeQ" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [{
"parts":[{"text": "Explain how AI works"}]
}]
}'
curl "https://api.cloudflare.com/client/v4/user/tokens/verify" \
-H "Authorization: Bearer YkCknq8Zo6BCpzJYvr2sh_VfxQ-ex1H-og1ZB-v1"
curl -X PATCH \
"https://api.cloudflare.com/client/v4/zones/dcf6d8bdb6fb5059b48966c619ae603f/rulesets/612686fdfbce476e9c6d6e7b906f776a/rules/20d472052b3d454c82f052991d6efe6a" \
-H "Authorization: Bearer $CF_AUTH_TOKEN" \
-d '{
"action": "js_challenge",
"description": "Enforce mTLS authentication",
"enabled": true,
"expression": "(not cf.tls_client_auth.cert_verified and http.request.uri.path in {\"\"})",
"id": "20d472052b3d454c82f052991d6efe6a",
"last_updated": "2026-01-27T02:51:55.550912Z",
"ref": "20d472052b3d454c82f052991d6efe6a",
"version": "1",
"position": {
"index": 1
}
}'
// import the Genkit and Google AI plugin libraries
import { gemini15Flash, googleAI } from '@genkit-ai/googleai';
import { genkit } from 'genkit';
// configure a Genkit instance
const ai = genkit({
plugins: [googleAI()],
model: gemini15Flash, // set default model
});
const helloFlow = ai.defineFlow('helloFlow', async (name) => {
// make a generation request
const { text } = await ai.generate(`Hello Gemini, my name is ${name}`);
console.log(text);
});
helloFlow('Ifut Coy');
plugins {
id("com.android.application")
// Add the Google services Gradle plugin
id("com.google.gms.google-services")
...
}
dependencies {
// Import the Firebase BoM
implementation(platform("com.google.firebase:firebase-bom:34.7.0"))
// TODO: Add the dependencies for Firebase products you want to use
// When using the BoM, don't specify versions in Firebase dependencies
implementation("com.google.firebase:firebase-analytics")
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
terima kasih
ReplyDeleteMantab
ReplyDelete