Skip to content

Instantly share code, notes, and snippets.

View amalshaji's full-sized avatar
:dependabot:

Amal Shaji amalshaji

:dependabot:
View GitHub Profile
#!/usr/bin/env bash
{ # this ensures the entire script is downloaded #
nvm_has() {
type "$1" > /dev/null 2>&1
}
nvm_echo() {
command printf %s\\n "$*" 2>/dev/null
@amalshaji
amalshaji / main.go
Created October 9, 2023 18:24
Simple reverse proxy in go
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net"
"os"
"regexp"
@amalshaji
amalshaji / replacer.sh
Created May 27, 2023 12:12
Replace template file environment placeholders with values from the environment
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 <input_file> <output_file>"
exit 1
fi
input_file=$1
output_file=$2
@amalshaji
amalshaji / README.md
Created May 14, 2022 05:46 — forked from lucianoratamero/README.md
Using Vite with Django, the simple way

Using Vite with Django, the simple way

This gist has most of the things I've used to develop the frontend using vite inside a monolithic django app.

Here's a boilerplate that uses this approach: https://github.com/labcodes/django-react-boilerplate

A couple of things to note:

  • it runs in SPA mode by default. If you want SSR, you may want to look into django_vite;
  • static files unrelated to your app, like images or fonts, should be served by django, instead of imported directly inside your frontend app;
.progress {
position: fixed;
top: 0;
z-index: 1000;
height: 4px;
width: 100%;
border-radius: 2px;
background-clip: padding-box;
overflow: hidden;
}
@amalshaji
amalshaji / build_server.sh
Last active September 21, 2021 11:24
deploy sapper to deta
npm run build
@amalshaji
amalshaji / 1d60e8b4-edae-47b5-97fd-1a8d3831b021.sh
Created August 14, 2021 18:45
GIST created by python code
├── Pipfile
├── Pipfile.lock
├── alembic.ini
├── db.py
├── db.sqlite
├── main.py
└── migrations
@amalshaji
amalshaji / fastapi_http_basic_logout.py
Created June 23, 2021 06:10
FastAPI HTTP Basic Logout demo
from fastapi import Depends, FastAPI, status
from fastapi.responses import HTMLResponse
from fastapi.security import HTTPBasic, HTTPBasicCredentials
app = FastAPI()
security = HTTPBasic()
HTML = """
<center>
<h1>Hello {username}</h1>