Skip to content

Instantly share code, notes, and snippets.

View ritingliudd01's full-sized avatar

Riting LIU ritingliudd01

  • hk01.com
  • Shenzhen, Guangdong Province, P. R. China
View GitHub Profile
@hos
hos / InjectRuntimePublicEnv.ts
Last active August 12, 2024 12:15
Workaround to use runtime variables in the next.js app (App Router), so you can change them after build.
import Script from 'next/script'
// Add this file to some Server Component, in my case I use this in `app/layout.tsx`
// Next.js, will inline all the process.env.SOMETHING variables into the code at build time.
// Which will force us to build the app for each environment we want to deploy to, with the
// only different being few environment variables. Instead, what we want is to get the environment
// dynamically from the runtime, so if we change them in the env and run the app again, it must
// use the new environment variables. To do this, we will inject the environment variables into
// the window object, so we can access them in the runtime.
@carlossless
carlossless / jenkins-port-forwarding.md
Last active December 14, 2023 15:49
Port Forwarding (8080 -> 80) with `pf` on Mavericks/Yosemite

Jenkins Port Forwarding (8080 -> 80) with pf on Mavericks/Yosemite

This guide is a fork from this gist. I've added minor adjustments to customise these rules to forward connections from an outsite interface like en0.

Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

1. Create the anchor file

Create an anchor file under /etc/pf.anchors/com.jenkins with your redirection rule like: