Arxiu: 2017/1

Ruby cheasheet

1234567891011121314# mock power2 function.def power2(x) x * xendrequire "test/unit"require 'mocha/test_unit'class TestSimpleNumber < Test::Unit::TestCase def test_simple expects(:power2).retur

Docker cheasheet

ubuntu bin/bash docker docker run -it ubuntu /bin/bash docker run argument to docker run such as /bin/bash overrides and CMD command we wrote in Dockerfile ENTRYPOINT cannot be overriden at run time w

Puppet cheasheet

simple puppet manifest 123456node 'yourhostname' { file { '/test.txt': ensure => 'present', content => inline_template("this is a test <%= %>\n"), &#

Kubernetes cheasheet

Check Cluster Status 1kubectl cluster-info Run an RC kubectl create -f redis-master-controller.yaml Check if running 12345kubectl get rckubectl get podsdocker ps | grep rediskubectl get serviceskubect

R cheasheet

Read log file and print line chart 12df = read.table("~/tmp/heapmem.log", header = FALSE)matplot(df$V4, type="l") in column 4 we have the heapmem it will produce the linechart. Getting help and exampl

NodeJS cheasheet

Remote debug nodejs app / use chrome developers to detect memory leaks Step 1 enable remote debug on a running nodejs process 1kill -SIGUSR1 $NODEJS_PID Now your nodejs process (V8) is listening on po

JavaScript cheasheet

Add replaceAll function to existing String object 1234String.prototype.replaceAll = function(search, replacement) { var target = this; return target.replace(new RegExp(search, 'g'), replace