Skip to content

Instantly share code, notes, and snippets.

View hungbang's full-sized avatar
🏠
Working from home

Harry B. hungbang

🏠
Working from home
View GitHub Profile
@hungbang
hungbang / java_conventions.md
Created September 23, 2019 02:08 — forked from goldbattle/java_conventions.md
Java Coding Conventions

Coding Conventions

This file will cover important coding practices that are important to stress when coding this program. Listed below are some of the more important details that should be stressed. Each programmer has his/her own way to deliver code. The importance of having similar coding conventions throughout this program are listed below.

  • 80% of the time spent on a piece of software goes to maintenance.
  • Hardly any software is maintained for its whole life by the original author.
  • Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.
  • If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.
@hungbang
hungbang / clean-docker.sh
Created August 8, 2019 04:13 — forked from marioharper/clean-docker.sh
Stop all docker processes, remove all containers, remove all images
# stop all processes
docker stop $(docker ps -aq)
# remove all containers
docker rm $(docker ps -aq)
# remove all images
docker rmi $(docker images -aq)
# delete all volumes
@hungbang
hungbang / gcb-kubernetes.yaml
Created November 1, 2018 15:13 — forked from Philmod/gcb-kubernetes.yaml
Deploy a new image from Google Cloud Container Builder to Kubernetes, by storing GKE credentials in GCS.
steps:
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
- name: 'gcr.io/cloud-builders/npm'
args: ['test']
- name: 'gcr.io/cloud-builders/docker'
args: ["build", "-t", "gcr.io/$PROJECT_ID/frontend:$REVISION_ID", "."]
- name: 'gcr.io/cloud-builders/docker'
args: ["push", "gcr.io/$PROJECT_ID/frontend:$REVISION_ID"]
- name: 'gcr.io/cloud-builders/gcloud'

Deploy project to ipfs

  1. Start Ipfs daemon to create a node

ipfs daemon

  1. To get your peers that will share content

ipfs swarm peers

@hungbang
hungbang / remove-node_modules
Created October 17, 2018 14:34 — forked from cassidoo/remove-node_modules
Remove node_modules from git
Add to .gitignore file
node_modules
Then call:
git rm -r --cached node_modules
git commit -m "Remove node_modules now that they're ignored!"
git push origin master
@hungbang
hungbang / import-db.sh
Created October 11, 2018 03:28 — forked from hartleybrody/import-db.sh
Copy data from Heroku Postgres into local database
# copy/import data from heroku postgres to localhost pg database
# useful for copying admin's work on live site into local database to reproduce errors
# https://devcenter.heroku.com/articles/heroku-postgres-import-export
# take heroku pg snapshot and download
heroku pg:backups:capture
heroku pg:backups:download
# load the dump into local postgres database, assuming $DATABASE_URL set locally
@hungbang
hungbang / 1_kubernetes_on_macOS.md
Created September 25, 2018 15:15 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@hungbang
hungbang / kubernetes.md
Created September 22, 2018 08:37 — forked from carlessanagustin/kubernetes.md
Kubernetes tutorial steps

1. Create cluster

Cluster up and running

minikube version
minikube start
kubectl version
@hungbang
hungbang / example.html
Created July 13, 2018 09:15 — forked from 2J/example.html
Angular 2 tabs example
<tabs>
<tab tabTitle="Tab 1">Tab 1 Content</tab>
<tab tabTitle="Tab 2" [active]="true">Tab 2 Content</tab>
<tab tabTitle="Tab 3" [disabled]="true">Tab 3 Content</tab>
<tab tabTitle="Link Tab 4" href="http://google.com">Link Tab</tab>
<tab tabTitle="Link Tab 5" href="http://google.com" [disabled]="true">Disabled Link Tab</tab>
</tabs>
@hungbang
hungbang / Sha1Hash.java
Created April 26, 2018 07:46 — forked from dleast/Sha1Hash.java
SHA1 Hash fuction - JAVA
public class Sha1Hash {
/** Creates a new instance of Sha1Hash */
public Sha1Hash() {
}
/**
* @param inputData
* @return
*/