Skip to content

Instantly share code, notes, and snippets.

@fl0wo
fl0wo / multi-db-migrate-turso-drizzle.ts
Created March 17, 2025 00:10
script that lists all multi-tenant databases and applies schema migrations using Turso and Drizzle.
import { createClient } from "@tursodatabase/api";
import { createClient as createTursoClient } from "@libsql/client"
import {migrate} from "drizzle-orm/libsql/migrator";
import {drizzle} from "drizzle-orm/libsql";
// THE SCHEMA OF THE ORG DBs (not the main one)
import * as schema from "../drizzle/org-schemas";
import {DEFAULT_API_TOKEN, TURSO_API_TOKEN} from "./secrets";
const listDBs = async () => {
@sergiodxa
sergiodxa / crud.ts
Last active March 15, 2025 21:49
A crud helper for RRv7 routes.ts file
import { index, prefix, route } from "@react-router/dev/routes";
import { camelize, pluralize, singularize } from "inflected";
function createCrud(base = "./views") {
/**
* Create a CRUD route configuration.
* @param name The name of the resource. It will be pluralized for the path.
* @param options The options for the crud.
* @param options.member Extra routes to add to each member.
* @param options.collection Extra routes to add to the collection.
@rauchg
rauchg / p.sh
Last active March 1, 2025 23:51
Perplexity CLI in pure shell
#!/usr/bin/env bash
function p() {
jq -n \
--arg content "$*" \
'{
"model": "pplx-7b-online",
"messages": [
{
"role": "system",
"content": "Be precise and concise."
@lukaselmer
lukaselmer / ExportOptions.plist
Created January 11, 2020 21:10
Create a Flutter .apk and .ipa file to upload it to Firebase App Distribution
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>ad-hoc</string>
<key>uploadBitcode</key>
<false/>
<key>uploadSymbols</key>
<true/>
import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
CanActivate,
Router,
RouterStateSnapshot,
} from '@angular/router';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@mbleigh
mbleigh / README.md
Last active September 25, 2020 04:26
Automate the deletion of old Firebase Hosting versions.

Firebase Hosting Version Cleanup

This is a simple utility script for cleaning up Firebase Hosting versions, leaving a specified number of versions remaining. This is primarily done to conserve storage usage, but may have other uses.

USE AT YOUR OWN RISK. NO WARRANTY IS PROVIDED. THIS SCRIPT DOES DELETE STUFF PERMANENTLY

Usage

node cleanupVersions.js [commit]

@kellyrmilligan
kellyrmilligan / s3Sync.sh
Created June 8, 2017 13:38
Sync files to s3 and set cache control headers
#!/bin/bash
if [[ "$1" != "" ]]; then
S3BUCKETNAME="$1"
else
echo ERROR: Failed to supply S3 bucket name
exit 1
fi
aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public
@joyrexus
joyrexus / README.md
Last active December 30, 2024 01:37
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@rgl
rgl / wait_for_http_200.sh
Last active February 18, 2025 11:37
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@henriquemenezes
henriquemenezes / android-generate-keystores.md
Last active February 25, 2025 04:08
Android: Generate Release/Debug Keystores

Android: Generate Release/Debug Keystores

Generate Keystores

Debug Keystore

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug"