Skip to content

Instantly share code, notes, and snippets.

View jaysson's full-sized avatar

Prabhakar Bhat jaysson

View GitHub Profile
@jaysson
jaysson / Dockerfile
Created August 18, 2024 14:31
The devcontainer setup for a Warpdocs golang SaaS
FROM mcr.microsoft.com/devcontainers/base:ubuntu
# Install Go
ARG TARGETARCH
ARG GO_VERSION=1.23.0
RUN curl -fsSL https://golang.org/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz | tar -C /usr/local -xzf -
RUN BIN="/usr/local/bin" && \
VERSION="1.37.0" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" \
@jaysson
jaysson / Dockerfile
Created January 28, 2024 09:32
Docker setup for AdonisJS V6
FROM node:lts-alpine3.19 AS builder
COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json
WORKDIR /app
RUN npm install
COPY ./ /app
RUN npm run build
FROM node:lts-alpine3.19
@jaysson
jaysson / readme.md
Last active December 30, 2023 05:38
Laravel server setup

This assumes root is logged in via SSH to the latest Ubuntu server, with the root SSH authorized keys stored in /root/authorized_keys. Another assumption is that you use postgres and redis hosted on different database servers, so we don't install those on the app server.

Server setup

Edit the SSH config and disable password login. Update the SSH port to something random.

vim /etc/ssh/sshd_config
systemctl reload sshd
@jaysson
jaysson / validation.ts
Last active July 15, 2023 06:03
Realtime validation in sveltekit
import { deserialize, applyAction } from '$app/forms';
import debounce from 'debounce';
/**
* After the first submission, asynchronously submits the form after new input
* The page action should return `fail(422, {data, errors}) when validation fails
* The actions should return a `fail(204, {data})` WITHOUT actually processing the form submission when `x-precognition` header is present and validation succeeds.
* Use it in your form: `<form method="post" use:validation>`
* @param form The form element on which the use directive is applied
*/
@jaysson
jaysson / TRPC.ts
Last active March 23, 2024 20:31
TRPC Integration for Adonis
import { initTRPC } from '@trpc/server';
import { resolveHTTPResponse } from '@trpc/server/http';
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
const t = initTRPC.create();
export const appRouter = t.router({
hello: t.procedure.query(() => {
return { message: 'World' };
}),