Skip to content

Instantly share code, notes, and snippets.

View gotraveltoworld's full-sized avatar
:octocat:
Keeping mind to learn Anything!

traveler gotraveltoworld

:octocat:
Keeping mind to learn Anything!
View GitHub Profile
@gotraveltoworld
gotraveltoworld / json_pp.md
Last active August 15, 2019 06:57
How prettify JSON using Command basing on Mac

How to use the one command to copy JSON prettify JSON.

  1. echo '{"test1": 1, "test2": true}' | json_pp => To show the result.
  2. echo '{"test1": 1, "test2": true}' | json_pp | pbcopy => To copy into paste note
@gotraveltoworld
gotraveltoworld / git_command.md
Last active August 13, 2019 02:29
How to rewrite the message of git commit.
@gotraveltoworld
gotraveltoworld / nodejsPath.js
Last active June 25, 2019 05:11
To memo the NodeJS's path library(include syntax and functions).
// Nodejs's Path built-in library.
let path = require('path');
// Get dir's path.
let dirPath = path.dirname('/xx/yy/zz.js');
console.log('dirPath', dirPath);
// Get join's path.
let joinPath = path.join(__dirname, '/xx');
console.log('joinPath', joinPath);
@gotraveltoworld
gotraveltoworld / Static_Class_method.py
Last active May 19, 2019 17:41
To show the Static_Class_method.
class First(object):
def member1(self, n):
return n
@classmethod
def member2(cls, n):
# Call the static member.
n += cls.member3(n)
# Call the normal member.
n += cls.member1(cls, n)
@gotraveltoworld
gotraveltoworld / imeExample.vue
Last active December 6, 2021 16:38
To show the 'v-model' compositionstart and compositionend.
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
<div id="app">
<p>the input is: <span class="name">{{result}}</span></p>
<input type="text"
:value=result
@input="compositionend"
@compositionstart="compositionstart($event)"
@compositionend="compositionend($event)"
/>
</div>
@gotraveltoworld
gotraveltoworld / JS_setTimeout.js
Created March 12, 2019 16:22
To practice the JS setTimeout: 測試迴圈內 "i" 的結果,這題要研究var 和 let 之間的關係(重點在全域綁定和區域綁定), let vs var
// 測試迴圈內 "i" 的結果,這題要重新研究var 和 let 之間的關係(重點在全域綁定和區域綁定)
for (var i = 0; i < 10; i ++) {
setTimeout(function() {
console.log(i);
}, 10);
}
for (let i = 0; i < 10; i ++) {
setTimeout(function() {
console.log(i);
}, 10);
@gotraveltoworld
gotraveltoworld / first_pod.yaml
Created February 7, 2019 14:58
To build my first pod.yaml.
# first_pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: k8s-pod-nodejs
labels:
app: webserver
spec:
containers:
- name: k8s-pod-nodejs
@gotraveltoworld
gotraveltoworld / kubectl_commands.md
Last active February 8, 2019 14:02
Commom kubectl statements.

Show pods info.

  kubectl get pods

Show all pods.

  kubectl get pods --show-all

Get specify pod's decribe.

@gotraveltoworld
gotraveltoworld / docker_flasks_lbs_with_nginx.yml
Created February 6, 2019 16:23
To build a simple flask cluster with nginx(lbs).
version: '3.7'
services:
app1:
container_name: app1-container
hostname: app1
restart: always
build:
context: ./app
dockerfile: Dockerfile
args:
@gotraveltoworld
gotraveltoworld / nginx_uwsgi.conf
Created February 6, 2019 16:10
Use upstream to support the uwsgi.
upstream uwsgi {
# for a file socket
server unix:///sock/app.sock;
}