Skip to content

Instantly share code, notes, and snippets.

View yubarajshrestha's full-sized avatar
👋
Hola

Yubaraj Shrestha yubarajshrestha

👋
Hola
View GitHub Profile
@yubarajshrestha
yubarajshrestha / settings.json
Created June 18, 2025 03:58
vscode settings for react project with biome instead of prettier and eslint
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"source.fixAll.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome",
// Configure specific file types to use Biome
"[javascript]": {
import crypto from 'crypto'
const algorithm = 'aes-256-cbc'
const { ENCRYPTION_KEY } = process.env
if (!ENCRYPTION_KEY || ENCRYPTION_KEY.length !== 64) {
throw new Error('ENCRYPTION_KEY must be a 256-bit hex string')
}
const key = crypto.createHash('sha256').update(ENCRYPTION_KEY).digest() // Ensure the key is 256 bits
@yubarajshrestha
yubarajshrestha / encryption_util.dart
Created July 5, 2024 16:09
encryption_util.dart
import 'dart:convert';
import 'package:crypto/crypto.dart' show sha256;
import 'package:encrypt/encrypt.dart' as encrypt;
import 'package:flutter_dotenv/flutter_dotenv.dart';
Future<String> getEncryptionKey() async {
String? encryptionKey = dotenv.get('ENCRYPTION_KEY');
// Ensure the key is 256 bits (32 bytes)
final keyBytes = sha256.convert(utf8.encode(encryptionKey)).bytes;
return base64.encode(keyBytes); // Use base64 instead of base64Url for compatibility
@yubarajshrestha
yubarajshrestha / pdf-to-image.js
Last active September 25, 2023 13:55
Take Screenshot from Website or PDF using Puppeteer.
const puppeteer = require('puppeteer');
// 14' macbook pro m1 screen viewport
const m1 = {
width: 1512,
height: 982,
deviceScaleFactor: 1,
}
/**
@yubarajshrestha
yubarajshrestha / ask_the_doc.py
Last active June 14, 2024 08:41
Ask the doc application based on provided pdf/text diagnosis reports
import streamlit as st
from langchain.llms import OpenAI
from langchain.text_splitter import CharacterTextSplitter
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import Chroma
from langchain.chains import RetrievalQA
openai_api_key = 'sk-<your-key>'
@yubarajshrestha
yubarajshrestha / selenium.ipynb
Created June 20, 2023 07:07
Scraping Using BS4 and Selenium
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.