Skip to content

Instantly share code, notes, and snippets.

View harshchandwani's full-sized avatar
💭
Expanding the Limits

Harsh Chandwani harshchandwani

💭
Expanding the Limits
View GitHub Profile
@harshchandwani
harshchandwani / tiktoken_encode_decode.py
Created October 5, 2025 10:24
Tiktoken encoding and decoding tokens
import tiktoken
enc = tiktoken.encoding_for_model("gpt-4")
text = "Hello, GPT"
tokens = enc.encode(text)
print(tokens)
import { PrismaClient } from '@prisma/client/edge'
import { withAccelerate } from '@prisma/extension-accelerate'
import { Hono } from "hono";
import { verify } from 'hono/jwt';
export const blogRouter = new Hono<{
Bindings: {
DATABASE_URL: string;
JWT_SECRET: string;
},
import { Link, useLocation } from "react-router-dom";
import { gradientBackgroundStyle } from "../utils/constants";
import { useState, useEffect } from "react";
const Header = () => {
const [isLogin, setIsLogin] = useState(false);
const location = useLocation();
useEffect(() => {
// Update isLogin state based on the current route
const express = require("express");
const jwt = require("jsonwebtoken");
const jwtPassword = "123456";
const app = express();
app.use(express.json());
const ALL_USERS = [
{
username: "harkirat@gmail.com",
password: "123",
@harshchandwani
harshchandwani / gist:c5210eb54237f34cbb0c8929d7d6353f
Created December 26, 2023 13:39
Header Issue #toBeResolvedBYMrAnujThakur in mean time
const express = require("express");
const app = express();
app.get("/health-checkup", function (req, res) {
// do health checks here
const kidneyId = req.query.kidneyKid;
const username = req.headers.username;
const password = req.headers.password;
if (username != "harsh" && password != "pass") {
res.status(403).json({
msg: "User doesnt exist",
@harshchandwani
harshchandwani / HospitalServer.js
Created December 25, 2023 07:04
This is a Server made in Express, with multiple functionality
const express = require("express");
const app = express();
var users = [{
name: "Harsh",
kidneys: [{
healthy: false,
}, {
healthy:true,
}]
}]