Skip to content

Instantly share code, notes, and snippets.

View Bishwas-py's full-sized avatar
🎯
Focusing

Bishwas Bhandari Bishwas-py

🎯
Focusing
View GitHub Profile
@Bishwas-py
Bishwas-py / charge.ts
Created March 23, 2024 14:42
redundant task in github
export async function charge_per_action(event: RequestEvent,
usage_title: string | null = null,
required_credit_amount = 2): Promise<MessageOut | null> {
if (!usage_title) {
usage_title = event.url.pathname;
}
try {
const response = await event.fetch(`$api/payout/charge/`, {
method: 'POST',
@Bishwas-py
Bishwas-py / find_error_with_error_loc.ts
Created January 9, 2024 09:16
django ninja/fastapi/pydantic loc errors to readable data
export type MessageType = 'success' | 'error' | 'warning' | 'info';
type MessageOutCommon = {
message_type?: MessageType
alias: string;
action_path?: string;
};
type MessageSingle = MessageOutCommon & {
message: string;
@Bishwas-py
Bishwas-py / mod-http-passenger.conf
Created July 21, 2022 06:36
mod-http-passenger.conf for rails app
### Begin automatically installed Phusion Passenger config snippet ###
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby2.7;
### End automatically installed Phusion Passenger config snippet ###
@Bishwas-py
Bishwas-py / nginx-for-rails-app
Created July 21, 2022 06:35
Nginx Setup for Rails app
server {
listen 80;
listen [::]:80;
server_name _;
root /home/username/rails-app-name/public;
passenger_enabled on;
passenger_app_env production;
@Bishwas-py
Bishwas-py / boogle-game-algorithm.py
Created June 17, 2022 05:56
Boogle game Algorithm
import random
import data
import string
def find_word_rec(check_board, mn_board, word, possibleCoordinates, temp, pos_words=[], cur_step=1):
# print('temp', temp, 'word', word)
_x, _y = possibleCoordinates
@Bishwas-py
Bishwas-py / profile-with-camera-in-tailwind-css.js
Created June 9, 2022 16:26
Profile with camera in tailwind css
<div className={"space-y-2 grid place-items-center"}>
<div
className={"p-1 relative shadow-sm bg-gradient-to-b from-purple-500 to-fuchsia-500 w-48 h-48 rounded-full"}>
<img
className={"object-cover rounded-full w-full h-full"}
src={"https://cdn.bio.link/uploads/profile_pictures/2022-06-09/38zFuPFJBsmcuzHNbishwas.png"}/>
<div className="bg-purple-500/50 rounded-full p-3 w-12 h-12
grid place-items-center absolute bottom-0 right-0">
<FontAwesomeIcon icon={faCamera} className={"text-white/60 text-2xl"}/>
</div>
@Bishwas-py
Bishwas-py / django_deploy.md
Created May 20, 2022 00:35 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@Bishwas-py
Bishwas-py / wm.py
Created March 3, 2022 16:39
webscraping and multiprocessing with py
def get_set_data(link, mp_data):
try:
articles = Article() # gets article information
article_data = {
'url': article.url,
'summary': article.summary,
'content': article.text,
'keywords': article.keywords,
'tags': article.tags
}
@Bishwas-py
Bishwas-py / EnemyFollowPlayerUnity2D.cs
Last active November 11, 2021 12:16
Enemy Follow Player Unity 2D
IEnumerator GiveJumpingJerks()
{
while (isPlayerAlive)
{
yield return new WaitForSeconds(Random.Range(1, 3));
try
{
var playerToTriangle = (player.transform.position - transform.position);
if (allowJumping)
{