Skip to content

Instantly share code, notes, and snippets.

@koisose
koisose / azure.ts
Created October 18, 2024 02:39
azure openai
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* Demonstrates how to get chat completions for a chat context.
*
* @summary get chat completions.
*/
import { AzureOpenAI } from "openai";
@koisose
koisose / Dockerfile
Created October 9, 2024 03:02
sharp nextjs docker
FROM oven/bun:alpine AS base
# Stage 1: Install dependencies
FROM base AS deps
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
# Stage 2: Build the application
FROM base AS builder
Oke, jadi Anda masih ingin berbicara tentang Mars. Baik. Mari kita bayangkan bahwa kurangnya medan magnet Mars entah bagaimana bukanlah masalah. Apakah Anda ingin mencoba mensimulasikan seperti apa kehidupan di Mars? Langkah pertama adalah membersihkan freezer Anda. Langkah kedua adalah mengunci diri Anda di dalamnya. (Anda dapat membawa ponsel Anda, jika Anda suka!) Ketika Anda merasa sangat lapar, orang yang Anda cintai di luar dapat mengantarkan makanan kepada Anda paling cepat sembilan bulan setelah Anda memintanya. Penantian sembilan bulan ini juga akan berlaku ketika Anda mulai menggedor bagian dalam freezer, memohon untuk dilepaskan.
Selamat: Anda sekarang telah mensimulasikan—Anda sekarang telah mati, dengan mengerikan, dalam satu atau dua hari, saat mensimulasikan—seperti apa kehidupan di Mars, setelah Anda memecahkan masalah tidak adanya satu tarikan napas pun udara untuk bernapas, di mana pun di seluruh planet. Kita tidak akan pernah hidup di Mars.
Mari kita bahas masalah udara yang dapat dihiru
@koisose
koisose / gist:25cbd702d13b422edbfe4c3301bae5ba
Created June 18, 2024 12:25
how to push to gitlab registry
podman login registry.gitlab.com
podman build --ulimit=nofile=131072:1048576 -t registry.gitlab.com/<gitlab username>/<repo name on gitlab> .
podman push registry.gitlab.com/<gitlab username>/<repo name on gitlab>
version: "3.8"
services:
pihole:
container_name: pihole
image: iloveitaly/pihole-scheduled-blocking:latest
restart: always
environment:
TZ: "America/Denver" # Put your own timezone here.
@koisose
koisose / thecode.ts
Last active March 9, 2024 12:04
the code
import Groq from "groq-sdk";
const groq = new Groq({
apiKey: ""
});
export async function generate(text:string) {
const completion = await groq.chat.completions.create({
messages: [
{
role: "system",
content: "you're summary generator create a summary of this markdown in a tweet style"
import addJobToQueue from "~/utils/bullmq/queue";
const imageBuffer = fs.readFileSync(
path.resolve("./src/media/sorry.png"),
);
export const onGet: RequestHandler = async ({ params, send }) => {
const fileName = path.resolve("./src/media/" + params.id);
try {
const data = { jobName: "create-image", id: params.id };
@koisose
koisose / fix.ts
Last active February 17, 2024 03:18
fix.ts
// addJobToQueue.ts
import { Queue } from "bullmq";
import { CONNECTOR, DEFAULT_REMOVE_CONFIG } from "./config";
import setUpWorker from "./worker";
import {Redis} from "ioredis";
let ready=false;
// @ts-ignore
let myQueue;
// @ts-ignore
@koisose
koisose / queue.ts
Last active February 17, 2024 03:18
queue.ts
// addJobToQueue.ts
import { Queue } from "bullmq";
import { CONNECTOR, DEFAULT_REMOVE_CONFIG } from "./config";
import setUpWorker from "./worker";
import Redis from "ioredis";
const connection = new Redis(CONNECTOR as any);
const myQueue = new Queue("JOBS", { connection });
myQueue.on("error", () => {
connection.disconnect();
import { GoogleGenerativeAI } from "@google/generative-ai";
import dotenv from 'dotenv';
import { execSync } from 'child_process'
dotenv.config();
import ky from 'ky';
const API_KEY = process.env.GOOGLE_API_KEY; // Replace with your actual API key
const systemMessage=`You are a commit message generator by creating exactly one commit message by the diff strings without adding unnecessary information! Here is the format of a good commit message from https://karma-runner.github.io/6.4/dev/git-commit-msg.html guides:
---