Skip to content

Instantly share code, notes, and snippets.

View lonelyH3b's full-sized avatar
🎯
Researching and fixing bugs

らきん lonelyH3b

🎯
Researching and fixing bugs
View GitHub Profile
@lonelyH3b
lonelyH3b / deployvercel.md
Created March 2, 2025 17:37
Deploy python microservices (Flask/FastAPI) on Vercel

Followings are the steps to deploy python microservices on Vercel.

  • Install Vercel CLI with npm install -g vercel
  • Now I have to create a json file for Vercel describing the source and destination route. The vercel.json file should be like this ```{ "version": 2, "builds": [ { "src": "app.py", "use": "@vercel/python" } ],
@lonelyH3b
lonelyH3b / FlaskInit.md
Created January 21, 2025 15:34
Setup Flask project.

How to Set Up a Flask App

To install Flask, simply run:

pip install flask

Then, create a Python file named app.py, which will act as the Controller in the MVC structure. This file will handle rendering templates and managing Python logic for the Flask application. Now, let's write the code for app.py:

@lonelyH3b
lonelyH3b / gitcommand.md
Last active May 23, 2025 14:27
Basic Git commands.

git add . stage all changes on a local git repo.

git add <filename> stage a specific file on repo.

git commit -m "Message" commit or save changes.

git status Displays the state of the working directory and the staged snapshot.

git init initialize a git repository(local).

@lonelyH3b
lonelyH3b / subsequence.py
Created December 4, 2024 15:06
2825. Make String a Subsequence Using Cyclic Increments
class Solution:
def canMakeSubsequence(self, str1, str2):
i = j = 0
while i < len(str1):
if j < len(str2) and (str1[i] == str2[j] or (str1[i] == 'z' and str2[j] == 'a') or ord(str2[j]) - ord(str1[i]) == 1):
j += 1
i += 1
return j == len(str2)
@lonelyH3b
lonelyH3b / data_cleaner.py
Last active April 26, 2024 17:37
Clean csv files in unravalled datasets.
import os
import re
import pandas as pd
from pprint import pprint
import io
# Define data cleaning function
def clean_data(df):
# Example: Remove leading and trailing whitespaces from all columns
@lonelyH3b
lonelyH3b / tax_calculate.sql
Created March 23, 2023 06:07
A PL/SQL code to calculate tax from employee table.
set serveroutput on
declare
emp_id employees.employee_id%TYPE := &empid ;
v_sal employees.salary%type;
tax number := 0;
begin
select salary into v_sal from employees
where employee_id = emp_id;
if(v_sal > 1000) then
@lonelyH3b
lonelyH3b / maximum_number.sql
Created March 22, 2023 19:41
PL/SQL code to find maximum number. This code takes 3 numbers as input and find the maximum number among them.
set serveroutput on
create or replace function find_max(
f_num number := &number,
s_num number := &number,
t_num number := &number)
return number is max_num number := 0;
begin
if(f_num > s_num) then
@lonelyH3b
lonelyH3b / area_circle.sql
Last active March 22, 2023 19:42
PL/SQL calculate area of circle.
set serveroutput on
create or replace function area_crl(
radius number := &number )
return number is area number := 0;
begin
area := (22/7)*radius*radius;
return area;
end;
@lonelyH3b
lonelyH3b / cgpa.java
Created March 4, 2023 16:48
CGPA calculation with java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner mark_input = new Scanner(System.in);
float summ = 0.0F;
for (int i=0;i<3;i++){
System.out.print("Please insert you mark of "+(i+1)+"th subject : ");
float mark = mark_input.nextFloat();
summ = summ + mark;
@lonelyH3b
lonelyH3b / Django_doc.txt
Last active November 1, 2022 15:37
Django's important documentations
I will share some important documentation links for django that are often needed in my work.
1. Making queries in django: https://docs.djangoproject.com/en/4.1/topics/db/queries/
2. Update data in database: https://www.youtube.com/watch?v=jCM-m_3Ysqk
3. If I have file or image data to update, I can follow this question: https://stackoverflow.com/questions/63298721/how-to-update-imagefield-in-django
4. Django REST API- https://www.django-rest-framework.org/tutorial/1-serialization/
5. JQuery Autocomplete: https://jqueryui.com/autocomplete/