Skip to content

Instantly share code, notes, and snippets.

View vanduc1102's full-sized avatar
🐛
💯 💯 💩 😆 🐢

Duke Nguyen vanduc1102

🐛
💯 💯 💩 😆 🐢
View GitHub Profile
@vanduc1102
vanduc1102 / sonar.sh
Created March 18, 2020 04:46
SonarQube command sample
sonar-scanner \
-Dsonar.projectKey=sample-project \
-Dsonar.sources=. \
-Dsonar.exclusions=vendor/**/* \
-Dsonar.host.url=https://localhost:9000 \
-Dsonar.login=keeeeeey
@vanduc1102
vanduc1102 / phpunit.xml
Created March 15, 2020 16:23
PHP Unit Code Coverage Setup phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/TestHelper.php"
backupGlobals="false"
backupStaticAttributes="false"
verbose="true"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
@vanduc1102
vanduc1102 / deployment.sh
Created January 15, 2020 12:37
checkout code and reload nodejs server
#!/bin/sh
# It is good practice to print the required versions on server.
# cause the code will execute in SSH non interactively mode.
# https://stackoverflow.com/questions/17089808/how-to-do-remote-ssh-non-interactively
echo "NodeJS: "$(node -v)
echo "NPM: "$(npm -v)
@vanduc1102
vanduc1102 / command.sh
Last active October 14, 2019 08:38
Scale Out and Update a Containerized Application on a Kubernetes Cluster https://www.qwiklabs.com/focuses/1739?parent=catalog
#step 0
gcloud config set project your_project_id_here
gsutil cp -r gs://$DEVSHELL_PROJECT_ID/ .
tar -xf source_code_file
#step1
docker build . -t echo-app
docker tag echo-app gcr.io/$DEVSHELL_PROJECT_ID:latest
docker push gcr.io/$DEVSHELL_PROJECT_ID:latest
@vanduc1102
vanduc1102 / step1-qwiklabs.jinja
Last active May 29, 2021 08:59
Configure a Firewall and a Startup Script with Deployment Manager https://www.qwiklabs.com/focuses/1736?parent=catalog
resources:
- type: compute.v1.instance
name: vm-test
properties:
zone: {{ properties["zone"] }}
machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/f1-micro
# For examples on how to use startup scripts on an instance, see:
# https://cloud.google.com/compute/docs/startupscript
metadata:
items:

Keybase proof

I hereby claim:

  • I am vanduc1102 on github.
  • I am vanducld (https://keybase.io/vanducld) on keybase.
  • I have a public key ASBqgX1ABCNQBvyOaNsjefVHLjbSb0LqyMHa1eeuVpQkZQo

To claim this, I am signing this object:

#!/bin/sh
$WORKSPACE=/path/to/179/server
cd $WORSPACE
git reset --hard HEAD
git checkout develop
git pull
npm install
@vanduc1102
vanduc1102 / gcp_project_id.sh
Created July 6, 2019 08:26
Get project id in google cloud shell
echo $GOOGLE_CLOUD_PROJECT
echo $DEVSHELL_PROJECT_ID
export GCLOUD_PROJECT=${DEVSHELL_PROJECT_ID}
@vanduc1102
vanduc1102 / main.twig
Last active June 17, 2019 04:51
TWIG - Swap element in a loop , swapping 444 and 222
{# to run the code https://twigfiddle.com/ #}
{% set arr = [1, 2 , 3 , 444, 222, 5 ,6 ,7 ,8 ,9]%}
{% set temp = null %}
{% for item in arr %}
{% if item == 444 %}
{% set temp = item %}
{% set item = arr[loop.index0 +1 ] %}
#!/usr/bin/env bash
ENV=production
PROJECT_ID=xxxxxxx
REGION=us-central1
echo "==================================${ENV}=========================="