Skip to content

Instantly share code, notes, and snippets.

View sibelius's full-sized avatar
🦈
give me a feedback https://entria.feedback.house/sibelius

Sibelius Seraphini sibelius

🦈
give me a feedback https://entria.feedback.house/sibelius
View GitHub Profile
@sibelius
sibelius / file-loader.js
Created March 9, 2025 14:50
tsx with node
import { transform } from '@swc/core';
import fs from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
const cwd = process.cwd();
export async function load(url, context, defaultLoad) {
if (url.endsWith('.tsx')) {
const filePath = fileURLToPath(url);
@sibelius
sibelius / download-cert-chain.ts
Created February 26, 2025 12:13
download cert chain
import fs from "fs";
import path from "path";
import forge from "node-forge";
const cwd = process.cwd();
function computeFingerprint(cert: forge.pki.Certificate): string {
const asn1Cert = forge.pki.certificateToAsn1(cert);
const der = forge.asn1.toDer(asn1Cert).getBytes();
const md = forge.md.sha1.create();
@sibelius
sibelius / mongodb-cronjob.yaml
Created January 31, 2025 15:07
Mongodb cronjob backup
apiVersion: batch/v1
kind: CronJob
metadata:
name: mongodb-backup-woovi-dev
namespace: mongodb-backup-dev
spec:
schedule: "0 1 * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
@sibelius
sibelius / mongodb1-deployment.yaml
Created January 31, 2025 15:02
basic mongodb k8s deployment
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: mongodb1
name: mongodb1
namespace: woovi-mongo-dev
spec:
replicas: 1
strategy:
@sibelius
sibelius / mongodb-rs.sh
Created November 13, 2024 18:09
mongodb-rs.sh
args="$@"
docker-compose up -d $args
sleep 5
updateEtcHost() {
local content=$1
if grep -q "$content" /etc/hosts; then
@sibelius
sibelius / validateWhatsAppSha256.ts
Created October 28, 2024 13:18
validate whatsapp sha 256
const signature = ctx.request.headers['x-hub-signature-256'];
if (
!signature ||
typeof signature !== 'string' ||
!config.WHATSAPP_APP_SECRET
) {
ctx.status = 403;
ctx.body = {
message: 'invalid signature',
import legacy from '@vitejs/plugin-legacy'
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
import relay from 'vite-plugin-relay';
// import { esbuildCommonjs, viteCommonjs } from '@originjs/vite-plugin-commonjs'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
// commonjs({
@sibelius
sibelius / renderToPipeableStreamPromise.ts
Created August 20, 2024 11:42
renderToPipeableStreamPromise
export const renderToPipeableStreamPromise = async (
tree: ReactElement,
ctx: Context,
next: Next,
) => {
const writableStream = new WritableAsPromise();
let didError = false;
const { pipe, abort } = renderToPipeableStream(tree, {
@sibelius
sibelius / ReloadServerPlugin.js
Created August 1, 2024 03:15
ReloadServerPlugin.js
const cluster = require('cluster');
const path = require('path');
const defaultOptions = {
script: 'server.js',
execArgv: [],
};
class ReloadServerPlugin {
constructor({ script, execArgv = [] } = defaultOptions) {
@sibelius
sibelius / woovi-frontend-review-feedback.md
Last active July 19, 2024 12:53
woovi-frontend-review-feedback

These are review based on woovi frontend junior challenge

  • deploy frontend
  • select a bundling tools like nextjs, vite, webpack or rspack
  • use css in js
  • make proper components
  • avoid hard coded values like colors, spacing, typography
  • create a mini design system
  • use a form library like formik
  • use a validation library like yup