Skip to content

Instantly share code, notes, and snippets.

View barelyhuman's full-sized avatar

Siddharth Gelera (reaper) barelyhuman

View GitHub Profile
@barelyhuman
barelyhuman / *Caddyfile.md
Last active February 23, 2025 23:10
Simple http2 server with caddy for static websites

Static File Server

Even though you should generally use a CDN for something like this, a very simple setup for smaller static websites on a VPS / VM is fine.

This gist comes with an example Caddyfile that can be used with caddy to serve any sub-folder in the /var/www path as a subdomain.

This reduces the overall effort required to create and register domains if you are going to keep it all on the same server.

The example Caddyfile shows how to set the flow up with the localhost domain but changing it to work with an actual domain should be rather simple and is documented as comments in the file.

@barelyhuman
barelyhuman / biome.json
Created December 19, 2024 07:28
my biome config focused on perf first , readability next
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"include": [
"**/*.mjs",
"**/*.js",
"**/*.css",
"**/*.json",
"**/*.jsx",
"**/*.njk"
@barelyhuman
barelyhuman / *soul.md
Last active December 19, 2024 07:24
Server MPA first builder script

Soul

Simple bundler and watcher for server apps written in nodejs using traditional methods of views and public javascript assets.

Usage

  1. Install deps
npm i -D chokidar tiny-glob esbuild-node-externals mri esbuild
@barelyhuman
barelyhuman / pkg-resolve.go
Created December 13, 2024 13:44
[For reference] simpler npm registry package resolver and downloader
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"log"

Simple Bundler

Simple bundler for JS Packages and Typescript type declarations

I don't like the complexity of the existing solutions and would like the most minimal code for running something.

This is not for your production use as a lot of cases and errors will not be pretty printed for you. If you wish for a more polished and production grade bundler, you'll have better luck with the following

@barelyhuman
barelyhuman / preact-missing.md
Last active March 13, 2024 22:08
Preact Ecosystem, missing list

But does Preact has/supports/can do this?

Comment down things you think React has and preact doesn't and we'll have a definitive list of things that people think preact lacks and things that need to be worked on.

You can follow the Public Board

Docker Deploy

Simple setup to use SSH as the way to transfer the docker image instead of using a registry

  • Certificate Management
  • Upload Inconsistencies
@barelyhuman
barelyhuman / zoned-date-fns.js
Last active November 3, 2023 08:28
zoned date-fns-utils
// import { addDays, subDays } from 'npm:date-fns'; // uncomment for deno
import {addDays,subDays} from "date-fns"
const getCurrentZone = () => Intl?.DateTimeFormat()?.resolvedOptions().timeZone
export function getZonedWeekday(date, zone = getCurrentZone()) {
const weekdayString = new Date(date).toLocaleString('en-GB', {
timeZone: zone,
weekday: 'long',
@barelyhuman
barelyhuman / *store.md
Last active September 29, 2023 22:02
simple callback based store

store

Simple store to write code based on value changes

const s = store({ data: 1 });

s.onChange((v) => {
 console.log({ v });