Posts

Showing posts from March, 2026

Better Auth on Cloudflare Workers with Hono and D1

Image
A TypeScript-based lightweight authentication service optimized for Cloudflare Workers Stack Summary 🔥 Hono A fast, lightweight web framework built on web standards. 🔒 Better Auth A comprehensive authentication framework for TypeScript. 🧩 Drizzle ORM A lightweight, high-performance ORM for TypeScript, built with DX in mind. 🐘 Cloudflare D1 A serverless Sqlite optimized for the cloud. Installation Hono Select cloudflare-workers template npm create hono Better Auth npm i better-auth Drizzle ORM npm i drizzle-orm npm i -D drizzle-kit Environment Variables Set the following environment variables to connect your application to Better Auth . echo " BETTER_AUTH_URL = http://localhost:8787" >> .env echo " BETTER_AUTH_SECRET = $(openssl rand -base64 32)" >> .env cp .env .dev.vars npx wrangler d1 create myDb --update-config Required Files:  .dev.vars  Used by Wrangler in local development In production, these should be set as Cloudflare Worker Secrets. .env Us...

To deactivate Intel Turbo Mode on a Linux MacBook

Image
Deactivate Intel Turbo Mode immediately caps CPU frequency to the base speed, reducing heat and increasing battery life. For a permanent change, create a systemd rule.  Temporary Method (Until Reboot) Run this command in your terminal to immediately disable turbo boost:  echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo To re-enable it, change the 1 to a 0.  Permanent Method (Across Reboots) Since this setting resets upon rebooting, create a startup rule using systemd-tmpfiles.  Create a new configuration file: echo "w /sys/devices/system/cpu/intel_pstate/no_turbo - - - - 1" | sudo tee /etc/tmpfiles.d/noturbo.conf Alternative: Using TLP  If you have tlp installed for power management, you can configure it to handle this automatically: Edit /etc/tlp.conf or /etc/default/tlp. Set INTEL_CPU_BOOST_ON_AC=0 and INTEL_CPU_BOOST_ON_BAT=0.  Verification You can check if Turbo Mode is active by reading the file: cat /sys/devices/system/cpu/intel_pstate/...

Tutorial VNC Server on Linux Debian Bookworm

Image
To set up an X11 VNC server on Debian, the recommended package is x11vnc , which provides remote access to an existing X session. Alternatively, you can use other VNC servers like TightVNC or TigerVNC to create a new, virtual X desktop session.  Using x11vnc to Access the Current Desktop  x11vnc is ideal for remote assistance or accessing the same desktop visible on the physical monitor.  Installation: sudo apt update && sudo apt install x11vnc Configuration and Usage: Set a VNC password (optional but highly recommended): x11vnc -storepasswd This creates a password file, typically located at ~/.vnc/passwd . Run the server: To run it in your current terminal session, use: x11vnc -display :0 You will likely need to use the -auth option or set the XAUTHORITY environment variable to grant x11vnc permission to connect to the X server.  x11vnc -auth -forever -loop -noxdamage -repeat -rfbauth ~/.vnc/passwd -rfbport 5900 -shared ncache_cr -ncache 10 -forever : k...

Tutorial TanStack Query React Native

Image
TanStack Query (formerly known as React Query) is often described as the missing data-fetching library for web applications, but in more technical terms, it makes **fetching, caching, synchronizing and updating server state** in your web applications a breeze. Installation npm i @tanstack/react-query Compatibility React Query is compatible with React v18+ and works with ReactDOM and React Native. Recommendations It is recommended to also use our ESLint Plugin Query to help you catch bugs and inconsistencies while you code. You can install it via: npm i -D @tanstack/eslint-plugin-query Example // App.tsx import {   QueryClient,   QueryClientProvider,   useQuery, } from '@tanstack/react-query'; import React from 'react'; import { Image, StatusBar, StyleSheet, Text, useColorScheme, View } from 'react-native'; import {   SafeAreaProvider,   useSafeAreaInsets, } from 'react-native-safe-area-context'; function App() {   const isDarkMode = useColorScheme() === ...