Skip to content

Instantly share code, notes, and snippets.

View brightzheng100's full-sized avatar

Bright Zheng brightzheng100

View GitHub Profile
@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.

@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 / git.md
Last active November 14, 2023 02:24
Some Useful Git Practices

Git Practices

Add Upstream Remote to Our Forked Git Repos

Assuming we have forked the repo.

Now we clone our forked repo:

$ git clone git@github.com:YOUR-USERNAME/THE-REPO.git
@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 / debug-gradle-project-in-eclipse.md
Created November 2, 2018 03:55
How to Debug Gradle Projects in Eclipse

Setting up gradle debug configuration for all projects

$ touch ~/.gradle/init.gradle
$ cat > ~/.gradle/init.gradle <<EOF
allprojects {
    tasks.withType(Test) {
        if (System.getProperty('DEBUG', 'false') == 'true') {
            jvmArgs '-Xdebug',
 '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009'
@brightzheng100
brightzheng100 / generate-internal-ca.md
Created October 11, 2018 08:01
How-to: Generate Internal CA

Create your CA database to keep track of signed certificates

$ mkdir private certs cnf csr crl
$ touch index.txt
$ echo 1000 > serial

Create Your OpenSSL Config File

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"
@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

➜ 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 / 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