Skip to content

Instantly share code, notes, and snippets.

Weiwei Jiang wjiangjay

Block or report user

Report or block wjiangjay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wjiangjay
wjiangjay / nginx.conf
Created Sep 23, 2019
registry with mutal tls authentication
View nginx.conf
events {
}
http {
server {
listen 443 ssl;
ssl_certificate /etc/origin/master/localhost.crt;
ssl_certificate_key /etc/origin/master/localhost.key;
ssl_client_certificate /etc/origin/master/ca-bundle.crt;
ssl_verify_client on;
location / {
@wjiangjay
wjiangjay / linker.groovy
Created Sep 13, 2019
jenkins file: general way to link any two job together
View linker.groovy
#! env groovy
/*
author : wjiang@redhat.com
*/
def first_job
def template_raw
def template_parsed
def template_completed
@wjiangjay
wjiangjay / make-local-cert.sh
Created May 29, 2019 — forked from jdeathe/make-local-cert.sh
Generate a Root CA + Intermediate CA for local (internal) use on Mac OSX using cfssl and add the intermediate certificate to your keychain so it can be trusted by your local browser.
View make-local-cert.sh
#!/usr/bin/env bash
# REF: https://github.com/cloudflare/cfssl
# Change working directory
cd -- "$(
dirname "${0}"
)" || exit 1
readonly CA_ROOT_CERT_KEY="ca-root"
View gist:0c3fbae2c092ae64348ecbc948b49b25
require 'sinatra'
require 'json'
use Rack::Auth::Basic, "Protected Area" do |username, password|
username == 'foo' && password == 'bar'
end
get '/' do
content_type :json
{ :sub => "014fbff9a07c", :preferred_username => "bob", :name => "user@example.com" }.to_json
@wjiangjay
wjiangjay / hanoi.go
Created Apr 15, 2019
hanoi tower solution
View hanoi.go
package main
import (
"fmt"
)
var sum int
func hanoi(n int, from, medium, to string) {
if n > 0 {
@wjiangjay
wjiangjay / evict.sh
Last active Apr 15, 2019
evict pod script for OpenShift Container Platform
View evict.sh
#!/bin/env bash
function usage {
echo -e "Usage: bash evict.sh <server host> <port> <user token> <namespace name of the target pod> <target pod>"
echo -e "Examples:"
echo -e "\tbash evict.sh api.example.com 6443 2Oewuqv33qz-6Heyen2dobGl2UH-TYRBi3zb1DfrX44 default h-1-z62gt"
}
function serverp {
oc ${COMMON_OPTIONS} version 2>&1 > /dev/null
if [[ $? != 0 ]]; then
View tripleangle.go
package main
/*
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
View shellsort.go
package main
import (
"fmt"
)
func shellsort(A, gaps []int) {
for gap := range gaps {
for i := gap; i < len(A); i++ {
temp := A[i]
@wjiangjay
wjiangjay / sigcapture.go
Created Aug 7, 2018
golang trap signal
View sigcapture.go
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
View quicksort.go
package main
import (
"fmt"
)
func quicksort(A []int, p, r int) {
if p < r {
q := partion(A, p, r)
quicksort(A, p, q-1)
You can’t perform that action at this time.