Author Archives: Niklas - Page 19

OpenShift: add project service thru web console example

OpenShifts web console can do a lot but adding new project services is only done thru importing yaml file (or text)

Here is one example of such a yaml text

apiVersion: v1
kind: Service
metadata:
  name: myapp
  labels:
    app: myapp
    name: myapp
spec:
  ports:
    - name: 8080-tcp
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: myapp
    deploymentconfig: myapp
  sessionAffinity: None
  type: ClusterIP

Tested on OpenShift Web Console v3.11.153

Run multiple Linux commands, one after the other

Run commands after another
Ex.

mkdir temp & cd temp & ls

Run commands after another if the previous command SUCCEEDS
Ex.

mkdir temp && cd temp && ls

Run commands after another if the previous command FAILS
Ex.

mkdir temp || echo 'mkdir failed'

Makefile: compile all *.cpp files and create individual executables

This is an example of a Makefile the compiles all *.cpp files in the current folder and turns them all into individual executables

CC=g++
CFLAGS=-c -Wall
SOURCES = $(wildcard *.cpp)
EXECS = $(SOURCES:%.cpp=%)

all: $(EXECS)

clean:
	rm $(EXECS)

Tested on OSX 10.14 and GNU Make 3.81