Skip to content

Instantly share code, notes, and snippets.

@gengue
gengue / deployer.ts
Created July 29, 2025 10:16
Mastra google cloud run functions deplolyer
import { join } from 'path';
import process from 'process';
import { Deployer } from '@mastra/deployer';
import { DepsService } from '@mastra/deployer/services';
import { move, writeJson } from 'fs-extra/esm';
export class GoogleCloudRunFunctionDeployer extends Deployer {
constructor() {
super({ name: 'GOOGLE_CLOUD_RUN_FUNCTION' });
this.outputDir = join('.google', 'output');
@gengue
gengue / local-domain
Last active July 3, 2025 09:18
Add local domains in MacOS
#!/bin/bash
# A script to add or remove local domains from the /etc/hosts file and
# optionally manage locally-trusted SSL certificates using mkcert.
# --- Configuration ---
HOSTS_FILE="/etc/hosts"
IP_ADDRESS="127.0.0.1"
# --- Help Function ---
@gengue
gengue / brainstorm.md
Created June 12, 2025 15:34
Claude code commands

Ask me one question at a time so we can develop a thorough, step-by-step spec for this idea. Each question should build on my previous answers, and our end goal is to have a detailed specification I can hand off to a developer. Let’s do this iteratively and dig into every relevant detail. Remember, only one question at a time.

Once we are done, save the spec as specs/{title}.md

Ask if the user wants to create a git repo on github. if so, commit the spec.md to git and push it to the newly created git repo.

Here’s the idea: $ARGUMENTS

@gengue
gengue / CLAUDE.md
Created May 26, 2025 08:05
Example of instructions for claude code in a nextjs codebase

Arcavel Project Guidelines

Commands

  • pnpm dev - Start dev server with Turbopack
  • pnpm build - Build for production
  • pnpm start - Run production build
  • pnpm lint - Run ESLint

Code Style

@gengue
gengue / base64.js
Created August 11, 2022 14:47
Encode and decode base64 with javascript
function encodeBase64(str) {
return window.btoa(unescape(encodeURIComponent(str)));
}
function decodeBase64(str) {
return decodeURIComponent(escape(window.atob(str)));
}
// Usage:
encodeBase64('✓ à la mode'); // "4pyTIMOgIGxhIG1vZGU="
@gengue
gengue / upload.js
Created December 14, 2021 14:08
Google Drive API - Upsert file . create or update a file
"use strict";
const fs = require("fs");
const path = require("path");
const { google } = require("googleapis");
const SCOPES = ["https://www.googleapis.com/auth/drive"];
const KEYFILE_PATH = "config/credentials.json";
const FOLDER_ID = "14DHCIe3CHdWSX_Z3PHPwsow-fVHE9ApG";
@gengue
gengue / setup_keyboard_for_vim.sh
Last active December 1, 2021 21:28
Keyboard settings for vim in Mac OS X + Iterm2
defaults write org.vim.ITerm ApplePressAndHoldEnabled -bool false
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
# restart
@gengue
gengue / cookie-manager.html
Created October 26, 2020 15:58
Set cross domain cookies with Single Page Applications
@gengue
gengue / Caddyfile
Created August 1, 2020 07:32
Caddy server automatic HTTPS for localhost - API + frontend using reverse proxy
# https://medium.com/@devahmedshendy/traditional-setup-run-local-development-over-https-using-caddy-964884e75232
# 1. sudo pacman -S mkcert
# 2. mkdir ./certs && cd ./certs
# 3. mkcert "*.sqila.local"
# 4. new line /etc/hosts/ -> 127.0.0.1 backend.sqila.local app.sqila.local
backend.sqila.local {
tls ./certs/_wildcard.sqila.local.pem ./certs/_wildcard.sqila.local-key.pem
reverse_proxy localhost:1337 {
header_up Host {host}
@gengue
gengue / index.js
Created July 3, 2020 23:20
Import trello list to wikijs
/*
* Get started
* 1. create a folder and run `npm init`
* 2. run `npm install graphql-request slugify`
* 3. copy this file inside the folder
* 4. edit config (trello json, API_KEY, SOURCE_LIST, TARGET_PATH, etc...)
* 5. run `node index.js`
*/
const { GraphQLClient } = require("graphql-request");
const slugify = require("slugify");