Skip to content

Instantly share code, notes, and snippets.

@peihsinsu
peihsinsu / cpu.js
Created December 27, 2015 10:35 — forked from bag-man/cpu.js
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
@peihsinsu
peihsinsu / gcp.commands.md
Last active September 3, 2015 01:16 — forked from qrtt1/gcp.commands.md
qrtt1提供的target pool bug操作流程

create

gcloud compute instances create my-unmanaged-instance --zone asia-east1-b
gcloud compute target-pools create my-pool --region asia-east1
gcloud compute forwarding-rules create my-rule --target-pool my-pool --region asia-east1
gcloud compute target-pools add-instances my-pool --instances my-unmanaged-instance --zone asia-east1-b
gcloud compute instance-templates create my-template
gcloud compute instance-groups managed create my-group --base-instance-name mgroup --size 1 --template my-template --target-pool my-pool --zone asia-east1-b
@peihsinsu
peihsinsu / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console