Skip to content

Instantly share code, notes, and snippets.

View Lulzx's full-sized avatar
👀
69 people are currently looking at this profile

Lulzx Lulzx

👀
69 people are currently looking at this profile
View GitHub Profile
@Lulzx
Lulzx / cf-workers-ai-bge-small.js
Created January 29, 2024 19:11 — forked from charlesteh/cf-workers-ai-bge-small.js
Cloudflare Workers AI baai/bge-small deployment script
// Made by @charlestehio: https://x.com/charlestehio
// Usage: https://abc.workers.dev/?query=your%20embedding%20query
import { Ai } from './vendor/@cloudflare/ai.js';
export default {
async fetch(request, env) {
// Parse the URL to get query parameters
const url = new URL(request.url);
var query = url.searchParams.get('query');
@Lulzx
Lulzx / resume.json
Last active January 27, 2024 07:11
{
"basics": {
"name": "Rishabh Singh",
"label": "Programmer",
"image": "",
"email": "john@gmail.com",
"phone": "(912) 555-4321",
"url": "https://johndoe.com",
"summary": "A summary of John Doe…",
"location": {
@Lulzx
Lulzx / handler.py
Created September 20, 2023 08:30
channel join request handler
import asyncio
from aiogram import Bot, Dispatcher, types
bot = Bot(token='TOKEN')
dp = Dispatcher(bot)
@dp.chat_join_request_handler()
async def handle_chat_join_request(chat_join_request: types.chat_join_request.ChatJoinRequest):
user_id = chat_join_request.from_user.id
channel_id = chat_join_request.chat.id
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
def calc_score(discount_percentage, average_rating):
return 1 / (1 + np.exp(-((2 * discount_percentage / 100) + (average_rating / 5) - np.maximum(0, 4 - average_rating))))
discount_percentages = np.linspace(0, 50, 100)
average_ratings = np.linspace(0, 5, 100)
@Lulzx
Lulzx / yt-chapters.js
Created August 29, 2023 05:11
Parser for chapters provided within description of YouTube videos
const parseChapters = (description) => {
// Extract timestamps (either 00:00:00, 0:00:00, 00:00 or 0:00)
const lines = description.split("\n")
const regex = /(\d{0,2}:?\d{1,2}:\d{2})/g
const chapters = []
for (const line of lines) {
// Match the regex and check if the line contains a matched regex
const matches = line.match(regex)
if (matches) {
@Lulzx
Lulzx / file.py
Created May 2, 2021 06:38
Longest Non Repeating Substring
s = "abcabcbb"
t = []
c = 0
n = 0
for i in s:
if i in t:
if c > n:
n = c
c = 0
t = [i]
@Lulzx
Lulzx / tell.c
Created December 21, 2020 09:44
c code
#include <stdio.h>
int findMin(int arr[], int n)
{
int min = arr[0];
for (int i = 1; i < n; ++i) {
if (arr[i] < min) {
min = arr[i];
}
}
<script lang="ts">
import { metatags } from "@roxi/routify";
import Theme from "./components/Theme.svelte";
import {
Content,
ContentSwitcher,
DataTable,
Form,
FormGroup,
Header,
<script lang="ts">
import { onMount } from "svelte";
let ref: HTMLInputElement;
let page: any = 0;
let pages: number = 1;
let rows: any[] = [];
let total: number;
let type: string = "title";
let state: string = "onload";
@Lulzx
Lulzx / book.svelte
Created November 21, 2020 12:45
book info
<script lang="ts">
import { onMount } from "svelte";
let loading = true;
let title: string,
subtitle: string,
description: string,
author: string,
year: string,