Skip to content

Instantly share code, notes, and snippets.

@qs-wang
qs-wang / gist:8ed0c5a6efcd29255166ff6c12dbab96
Created November 11, 2019 02:56
Run docker inside docker for CI/CD
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock mycontainer
@qs-wang
qs-wang / gist:af698c41a25913ae91d984e6c149d23f
Created October 31, 2019 23:35
react-route exact matching
/*
Hard to remember
For mathch sub path seperately, for example
/jobs
/jobs:id
neect the exact keyword with Route
*/
<Route exact path={prop.path} component={prop.component} key={prop.key}
@qs-wang
qs-wang / findDOMNode
Created October 21, 2019 22:18
findDOMNode deprecated
## The findDOMNode is deprecated
class MyComponent extends Component {
componentDidMount() {
findDOMNode(this).scrollIntoView();
}
render() {
return <div />
}
}
@qs-wang
qs-wang / findDOMNode
Created October 21, 2019 22:18
findDOMNode deprecated
## The findDOMNode is deprecated
class MyComponent extends Component {
componentDidMount() {
findDOMNode(this).scrollIntoView();
}
render() {
return <div />
}
}
@qs-wang
qs-wang / map.sh
Last active August 8, 2019 23:38
shell script provides the key/value access
#!/bin/bash
# credit to https://stackoverflow.com/questions/41150814/how-to-echo-all-values-from-array-in-bash
# Define a hash like this
MYHASH=("firstName:Milan"
"lastName:Adamovsky")
# Function to get value by key
getHashKey()
{
declare -a hash=("${!1}")
@qs-wang
qs-wang / ssm.go
Last active August 7, 2019 23:37
Get value from AWS system store. Picks the AWS_PROFILE from env
package awsutils
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
)
@qs-wang
qs-wang / curl.md
Created July 31, 2019 00:06 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@qs-wang
qs-wang / commadelimitedlist parameters
Created July 8, 2019 06:13
CommaDelimitedList parameter and ref as list in CloudFormation
Parameters:
Accounts:
Type: CommaDelimitedList
Resources:
DeploymentTestContentBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
du -sh * | sort -h
@qs-wang
qs-wang / k8s_logs_deployment
Last active December 19, 2018 04:51
Keep pulling the logs fro all pods of one kubernetes deployment
#!/usr/bin/env bash
DEPLOYMENT=$1
while :
do
for p in $(kubectl get pods | grep ^${DEPLOYMENT}- | cut -f 1 -d ' '); do
echo ---------------------------
echo $p
echo ---------------------------