Wednesday, April 11, 2018

To add/delete a NAT rule


# To add a rule

// you are listening on a server @ and want to expose to ouside.
// you can add a rule as below.
// now anyone accessing YOUR_NODE_IP_ADDRESS:8443 will be redirected to
iptables -t nat -A PREROUTING -p tcp --dport 8443 -j DNAT --to-destination

# To delete a RULE

// This will list according to groups like PREROUTING , INPUT, OUTPUT, POSTROUTING , etc.,
iptables -t nat -L --line-numbers

// to delete a specific rule
iptables -t nat -D PREROUTING <number>

// For example, here to delete third rule
iptables -t nat -D PREROUTING 3


Monday, April 9, 2018

force delete a pod in openshift (kubernetes)

kubectl delete pod --grace-period=0 --force --namespace <NAMESPACE> <PODNAME>

and for openshift

oc delete pod --grace-period=0 --force --namespace <NAMESPACE> <PODNAME>

This command may be use for deleting pods whose status is Unknown.

Thursday, April 5, 2018

label a node in openshift

How to label a node in openshift as 'infra' ? 

# oc describe node


# oc label node region=infra 
error: 'region' already has a value (primary), and --overwrite is false

# oc label node region=infra   --overwrite
node "" labeled

# oc describe node

Tuesday, March 20, 2018

Artificial intelligence and Machine learning

Attended a meetup on AI and Machine learning conducted by Harinder.

Short notes on same:

AI -> artificially created intelligence

Machine learning is an *important* approach to AI. (There are many approaches out there).

Some applications:

Why Candy crush was so famous ?

       According to the player's habits, the game adjusts itself to ensure that the player stays for long.

Facebook, Google maps etc., makes use of AI.

recaptcha -> use this to crowsource old book's scanning.

youtube suggestions

Spam  detection

Deep learning

Natural language processing.

John Mccarthy coined the term AI.  1959.

many developments followed especially games played by AI.

1997 -> Deepblue played chess
2005 -> self driving car
2011 -> watson jeopardy
2016 -> alphago game

Don't take games lightly :)

2005 -> 135 Exabyte human data
Now -> 100,000 exabytes !!
(1 Exabyte -> 1000 PB -> 1PB=1000 TB -> 1TB=1000 GB)

So much of DATA and so  much of computing power, hence good interest now.

Given x and y whose values are linear , AI can figure out
 y = mx+c
// slope and interceptor

Here, y=mx+c is the model figured out by AI.
It can use the model to get output for any input.

what if scatter plot ?

    make use of squares to get smaller numbers.

Fit the DATA -> important term

Fit the DATA to figure out the MODEL.

machine learning -> supervised
                             -> unsupervised

                              supervised -> regression
                                                 -> classification

supervised -> labelled.
unsupervised -> unlabeled.

Regression -> continuous output
classification -> well defined classes

Machine learning:

1. Fit

                  data -> learning -> model

eg: model -> y = mx+c
2. Predict
                 testdata -> model -> New value (prediction)

So, out of 30 test data

Use 20 test data get the model.

input 10 test data -> use model and get output
compare with actual output.

helps to know whether algorithm is good / bad.

model -> forumla / rules.

test data =================
                                                            -> test data accuracy
actual output   -----------------------

train data  =================
                                                               -> train data accuracy
actual output  -----------------------

(test data is part of train data)

Avoid over fitting (100% data accuracy).
(Remembered) data

4 important points in ML:

1. good data - data needs to be cleaned.
2. Algorithm
3. Features.
4. Parameter tuning.

AI framework :

Machine learning in python:

Friday, March 16, 2018

Check whether rpm signed or not

How to check whether rpm signed or not ?

rpm -K <your rpm file>

If signed, sha1 md5 OK

If not signed, md5 NOT OK (MISSING KEYS: XYZ.. )