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 / cursor.sh
Last active April 21, 2025 13:23
Cursor installer / uninstaller for linux, Fedora, Ubuntu, Arch or distros
#!/bin/bash
# Set default paths and URLs
DOWNLOADS_DIR="$HOME/Downloads"
APPLICATIONS_DIR="$HOME/.local/bin" # More appropriate location for AppImages
ICON_URL="https://www.cursor.com/apple-touch-icon.png"
APPIMAGE_URL="https://downloads.cursor.com/production/61e99179e4080fecf9d8b92c6e2e3e00fbfb53f4/linux/x64/Cursor-0.48.9-x86_64.AppImage"
ICON_FILENAME="cursor-icon.png"
APPIMAGE_FILENAME="Cursor-0.48.9-x86_64.AppImage"
DESKTOP_FILE="$HOME/.local/share/applications/cursor-editor.desktop"
package main
import (
"slices"
"strings"
)
var alphabets = []string{
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",
"x", "y", "z",
package main
import (
"fmt"
"time"
)
func main() {
const iterations = 1000000 // Using a large number to make the difference more noticeable
@Bishwas-py
Bishwas-py / donations_live.html.heex
Created June 28, 2024 02:09
lib/live_view_studio_web/live/donations_live.html.heex
<h1>Food Bank Donations</h1>
<div id="donations">
<div class="wrapper">
<table>
<thead>
<tr>
<th class="item">
<.sort_link opts={@opts} sort_by={:item}>
Item
</.sort_link>
@Bishwas-py
Bishwas-py / donations_live.ex
Created June 28, 2024 02:09
lib/live_view_studio_web/live/donations_live.ex
defmodule LiveViewStudioWeb.DonationsLive do
use LiveViewStudioWeb, :live_view
alias LiveViewStudio.Donations
import LiveViewStudioWeb.SortComponents
def mount(_params, _session, socket) do
donations = Donations.list_donations()
socket =
@Bishwas-py
Bishwas-py / sort_components.ex
Created June 28, 2024 02:07
lib/live_view_studio_web/components/layouts/sort_components.ex
defmodule LiveViewStudioWeb.SortComponents do
use Phoenix.Component
def valid_sort_by(%{"sort_by" => sort_by}) do
String.to_atom(sort_by)
end
def valid_sort_by(_), do: :id
def toggled_sort_order(opts, sort_by) do
@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;