Skip to content

Instantly share code, notes, and snippets.

View brightzheng100's full-sized avatar

Bright Zheng brightzheng100

View GitHub Profile
@brightzheng100
brightzheng100 / Multiple JDK versions in MacOS.md
Created January 12, 2024 09:14
Multiple JDK versions in MacOS

Install whatever versions you need

brew install openjdk@8
brew install openjdk@11
brew install openjdk@17

View what versions are now available

@brightzheng100
brightzheng100 / ffmpeg.md
Created October 17, 2022 09:02
MP4 processing with ffmpeg

It's frustrating to have a much bigger file exported from iMovie. For example, a editing of WebEx recording, which is MP4 file, in iMovie and exporting it out as MP4, will significantly increase the size, say from 300MB to 2.5GB.

The simplest way to shrink it, based on my experiments, is to use ffmpeg:

ffmpeg -i source.mp4 -c:v libx265 -preset fast -crf 28 -tag:v hvc1 -c:a eac3 -b:a 224k output.mp4
@brightzheng100
brightzheng100 / self-signed-cert-on-chrome.md
Created September 26, 2022 03:30
Easiest way to bypass the NET:ERR_CERT_INVALID in Chrome, with self-signed cert

Once you encounter that, right click the page and click "inspect".

Then switch to "Console" and copy-and-paste below command, then enter:

sendCommand(SecurityInterstitialCommandId.CMD_PROCEED)

Boom, it will work within seconds.

It's common that we use business email to commit for work while using personal email to commit for OSS.

You can configure an individual repo to use a specific user / email address which overrides the global configuration.

Let say we want to make the OSS commits as default, do this:

From the root of the repo, run

git config user.name "Your biz name here"
➜ CRC crc delete
Do you want to delete the OpenShift cluster? [y/N]: y
Deleted the OpenShift cluster
➜ CRC crc cleanup
INFO Unload CodeReady Containers tray
INFO Unload CodeReady Containers daemon
INFO Removing launchd configuration for tray
INFO Removing launchd configuration for daemon
INFO Removing current user permission for /etc/hosts file
INFO Will use root access: change ownership of /etc/hosts
@brightzheng100
brightzheng100 / opentab.sh
Created January 22, 2020 04:31
iTerm Tips
#!/bin/bash
# Ref: https://gist.github.com/bobthecow/757788
# Purposes: to open a new iTerm tab vertically, with the same profile, and run the command.
# Usage: source it and
# tab Opens the current directory in a new tab
# tab [PATH] Open PATH in a new tab
# tab [CMD] Open a new tab and execute CMD
# tab [PATH] [CMD] ... You can prob'ly guess
@brightzheng100
brightzheng100 / STS-failed-to-start.md
Last active February 5, 2020 04:38
Java Development in Mac Tips

Sometimes STS/Eclipse failed to start: failed to create java virtual machine.

It might be caused by multiple JDKs installed.

So we have to specify if it helps.

$ sudo vi /Applications/STS.app/Contents/Eclipse/STS.ini
...
-vm
@brightzheng100
brightzheng100 / dnsmasq_in_mac.md
Last active July 21, 2020 08:21
Mac Book Pro

Install Local DNS by dnsmasq in Mac

Install dnsmasq

brew update
brew install dnsmasq

Configure dnsmasq

@brightzheng100
brightzheng100 / .vimrc
Last active November 5, 2019 08:04
k8s-get-started
set autoindent
set tabstop=2 shiftwidth=2 expandtab
set history=50
set hlsearch
set ignorecase
set incsearch
set linebreak
set listchars=eol:¶
set list
set nobackup
@brightzheng100
brightzheng100 / credhub-interpolate.yml
Created January 3, 2019 02:38
credhub-interpolate.yml
# The inputs, outputs, params, filename, and filepath
# of this task file are part of its semantically versioned API.
# See our documentation for a detailed discussion of our semver API.
# See www.semver.org for an explanation of semantic versioning.
# code_snippet credhub-interpolate start yaml
---
platform: linux
inputs: