Skip to content

Instantly share code, notes, and snippets.

View ItsWendell's full-sized avatar

Wendell Misiedjan ItsWendell

View GitHub Profile
@ItsWendell
ItsWendell / fix_zenbook_audio.sh
Created May 23, 2025 10:41
ASUS Zenbook UX5406SA (Lunar Lake) audio fix
#!/bin/bash
# === WARNING: This script is AI generated and might not always work as expected ===
# ==============================================================================
# Script to fix audio on ASUS Zenbook UX5406SA (and similar models)
# with Lunar Lake CPUs on Fedora and other modern Linux distributions.
#
# This script automates the steps discussed, which involve:
# 1. Installing specific SOF (Sound Open Firmware) topology files.
@ItsWendell
ItsWendell / r2-to-zip.ts
Created April 11, 2025 10:39
Zip multiple files in bulk from R2 in Cloudflare Workers
import { type DeflateOptions, Zip, ZipDeflate } from "fflate";
export interface R2ToZipOptions {
/**
* Maximum number of files to process concurrently.
*
* @default 2
*/
concurrency?: number;
/**
@ItsWendell
ItsWendell / wait-until-after.tsx
Created October 29, 2024 15:38
`waitUntil` and `unstable_after` after support for @cloudflare/next-on-pages
import { getOptionalRequestContext } from "@cloudflare/next-on-pages";
import { workAsyncStorage } from "next/dist/server/app-render/work-async-storage.external";
export type AfterTask<T = unknown> = Promise<T> | AfterCallback<T>;
export type AfterCallback<T = unknown> = () => T | Promise<T>;
export function waitUntil(promise: Promise<unknown>) {
const cloudflareCtx = getOptionalRequestContext();
if (!cloudflareCtx) {
@ItsWendell
ItsWendell / Dockerfile
Created October 22, 2023 09:58
Postgres Dockerfile with Custom Extensions using pgxn
## Alternatives: postgres:15-alpine
ARG BASE_IMAGE=postgis/postgis:15-3.4-alpine
## Custom Alpine Postgres docker file with custom extensions
FROM ${BASE_IMAGE} as builder
# Install required dependencies
RUN apk --no-cache add \
python3 \
@ItsWendell
ItsWendell / postgisGeometry.ts
Last active April 5, 2024 08:50
Experimental PostGIS geometry GeoJSON column type for Drizzle ORM
import { sql } from "drizzle-orm";
import { customType, CustomTypeValues } from "drizzle-orm/pg-core";
/**
* Experimental custom type for PostGIS geometry, only supports reads
*/
export const geometry = <
TType extends GeoJSON.Geometry["type"] = GeoJSON.Geometry["type"],
T extends CustomTypeValues = CustomTypeValues,
>(
@ItsWendell
ItsWendell / geometryType.ts
Created October 21, 2023 15:23
Experimental / hacky custom drizzle column for PostGIS geometry (injection method)
export type GeometryTypes = {
Point: GeoJSON.Point;
LineString: GeoJSON.LineString;
Polygon: GeoJSON.Polygon;
MultiPoint: GeoJSON.MultiPoint;
MultiLineString: GeoJSON.MultiLineString;
MultiPolygon: GeoJSON.MultiPolygon;
GeometryCollection: GeoJSON.GeometryCollection;
};
@ItsWendell
ItsWendell / action.yaml
Last active November 19, 2023 17:23
Turbo Summarize Github Actions Action
name: "Summarize Turborepo Output"
description: "Summarize Turborepo output for GitHub Actions"
runs:
using: "composite"
steps:
- shell: bash
name: "Summarize Turborepo Output"
run: |
latest_json=$(ls -t .turbo/runs/*.json | head -1)
@ItsWendell
ItsWendell / expo-runtime.ts
Last active August 25, 2023 08:18
Expo: Runtime Versioning based on pnpm lock
#!/usr/bin/env -S pnpm tsx
import crypto from "crypto";
import fs from "fs";
import path from "path";
import {
createFingerprintAsync,
diffFingerprintChangesAsync,
} from "@expo/fingerprint";
const projectRoot = process.cwd();
@ItsWendell
ItsWendell / with-next-link.ts
Created July 22, 2021 22:15
withNextLink - Higher Order Component for Linkable components to support Next.JS Routing / Links
@ItsWendell
ItsWendell / PLPGSQL-nanoid.sql
Created May 4, 2021 14:07
NanoID Implementation in PL/pgSQL for Postgres.
-- Highly performant NanoID implementation in PL/pgSQL.
--
-- NOTE: This is a concept implementation, hasn't been battle tested.
--
-- Version: 0.1
-- Inspired by https://github.com/Jakeii/nanoid-postgres
-- @author github.com/ItsWendell
CREATE OR REPLACE FUNCTION gen_nanoid(size int DEFAULT 21)
RETURNS text AS $$