Skip to content

Instantly share code, notes, and snippets.

@IvanWei
IvanWei / deploy-to-target-branch.sh
Last active September 11, 2017 03:31
Deploy to target branch (e.g. gh-pages)
#!/bin/bash
set -e # stop on error
echo get last commit
git pull
echo add dist folder
git add -f dist
echo commit changes
git commit -m "deploy to gh-pages"
echo push to remote target branch (gh-pages is target branch)
@IvanWei
IvanWei / permission_collaborator_github.md
Last active September 28, 2017 02:59
View, add, delete collaborator on Github repository

View collaborator's permission on Github repository

curl -u [owner] \
  https://api.github.com/repos/[owner]/[repository]/collaborators/[username]/permission

Add user as a collaborator to Github repository has admin permission

  • admin: read, write, admin
  • push: read, write ( default when add user as a conaborator )
  • pull: read
@IvanWei
IvanWei / pm2_check_app_name.sh
Created March 26, 2019 02:04
Check app name exist, or not in PM2 (JS)
#!/bin/bash
# Set App name
APP_NAME=node_server
# Get information by app name with pm2
pm2 describe $APP_NAME > /dev/null
# Save data of previous shell to here
IS_EXIST_BY_APP_NAME=$?
@IvanWei
IvanWei / cloudbuild.yaml
Created November 5, 2021 02:50
CI/CD with Google Cloud to GCE by manual
steps:
- name: 'docker/compose:1.29.2'
args:
- build
id: build-images
- name: gcr.io/cloud-builders/docker
args:
- '-c'
- >-
docker push $$APP_CACHE_DOCKER_IMAGE:$$RELEASE_IMAGE_VERSION && docker