Skip to content

Instantly share code, notes, and snippets.

View brightzheng100's full-sized avatar

Bright Zheng brightzheng100

View GitHub Profile
@brightzheng100
brightzheng100 / bash-tips.md
Last active November 16, 2018 03:36
some bash tips

To cat all files within specified files and folders

$ tail -n +1 file1 folder1/* folder2/*
==> file <==
<content of file>

==> folder1/file1 <==
<content of folder/file1>
@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 / bosh-scp.md
Created October 27, 2018 13:38
BOSH SCP Tips

Issue / Problem Statement

If we bosh scp directly to folders under /var/vcap/jobs/xxx/config, you will encounter Permission denied like:

$ bosh -e lite -d concourse4 scp concourse.yml web:/var/vcap/jobs/uaa/config/

Using environment '192.168.50.6' as client 'admin'
@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 / sign-certs-with-internal-ca.md
Last active October 11, 2018 08:03
How-to: Sign Certs With Internal CA

Please refer to here for how to generate internal CA.

Generate Key and CSR

$ openssl genrsa -out private/example.key.pem 2048

$ cat > cnf/example.cnf <<EOF
[ req ]
@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

@brightzheng100
brightzheng100 / ca.md
Created September 1, 2018 17:36 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@brightzheng100
brightzheng100 / cf-serviceinstances.sh
Last active April 13, 2018 15:53
List all granted orgs' service instances
#!/bin/bash
# Dependencies: cf, jq >= 1.5
set -euo pipefail
umask 0077
PROPERTIES_TO_SHOW_H=("#" guid name last_operation last_operation_at service_name organization space)
PROPERTIES_TO_SHOW=(.metadata.guid .entity.name .entity.last_operation.state .entity.last_operation.updated_at .extra.service_name .extra.organization .extra.space)
@brightzheng100
brightzheng100 / cf-serviceinstances.sh
Created April 13, 2018 04:39
List all service instances in PCF foundation
#!/bin/bash
ORIGINAL_TARGET_ORG=`cf target | awk '/org:/{ print $2 }'`
ORIGINAL_TARGET_SPACE=`cf target | awk '/space:/{ print $2 }'`
ALL_ORGS=(`cf orgs | awk 'NR > 3'`)
# flag for printing the header
PRINT_HEADER=0
Mon Mar 27 08:34:47 UTC 2017