Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# devops
this is a test
45 changes: 45 additions & 0 deletions elk/certificate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
https://kpitest.qa-mpad.azure.cloud.bmw:5601/app/home#/


COPY CERTIFICATE:
scp kpitest.qa-mpad.azure.cloud.bmw.cer qxz2gui@10.11.115.13:/home/qxz2gui

CONVERT CER TO CRT:
openssl x509 -inform PEM in kpitest.qa-mpad.azure.cloud.bmw.cer -out kpitest.qa-mpad.azure.cloud.bmw.crt





sudo vim /etc/nginx/sites-available/elk.conf


server {
listen [::]:80;
listen 80;

server_name kpitest.qa-mpad.azure.cloud.bmw;

return 301 https://kpitest.qa-mpad.azure.cloud.bmw;$request_uri;
}

server {
listen [::]:443 ssl http2;
listen 443 ssl http2;

server_name kpitest.qa-mpad.azure.cloud.bmw;

ssl_certificate /etc/nginx/certs/kpitest.qa-mpad.azure.cloud.bmw.crt;
ssl_certificate_key /etc/nginx/certs/kpitest.qa-mpad.azure.cloud.bmw.key;
location / {
proxy_pass http://localhost:9200;
proxy_redirect off;
proxy_read_timeout 90;
proxy_connect_timeout 90;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}

ln -s /etc/nginx/sites-available/elk.conf /etc/nginx/sites-enabled/elk.conf
24 changes: 24 additions & 0 deletions network/certificates/extract_p7b.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Export all certificates into one file

```bash
$ base64 -d <P7B_FILE>.p7b | openssl pkcs7 -inform DER -print_certs -out <PEM_FILE>.pem
```

We'll get three certificates inside `<PEM_FILE>.pem` file, from top to bottom:
1. Certificate for the route in PEM format
2. CA certificate chain for the route validation in PEM format
3. Root CA certificate in PEM format

Validate key - certificate pair with following commands

```bash
$ openssl pkey -in <PRIVATE>.key -pubout -outform pem | sha256sum
```
Example output: **bb912b1c6614a0462556b2826b7dce6083a9b58049008a656706234d45abd4c6**

```bash
$ openssl x509 -in <ROOT_CA>.cer -pubkey -noout -outform pem | sha256sum
```
Example output: **bb912b1c6614a0462556b2826b7dce6083a9b58049008a656706234d45abd4c6**

this is a test
41 changes: 41 additions & 0 deletions python/01/calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
def add(x, y):
return x + y

def subtract(x, y):
return x - y

def multiply(x, y):
return x * y

def divide(x, y):
return x / y


print("Select operation:")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")

while True:
choice = input("Enter choice(1/2/3/4)")

if choice in ('1','2','3','4'):
num1 = float(input("Enter first number:"))
num2 = float(input("Enter second number:"))

if choice == '1':
print(num1, "+", num2, "=", add(num1, num2))
elif choice == '2':
print(num1, "-", num2, "=", subtract(num1, num2))
elif choice == '3':
print(num1, "*", num2, "=", multiply(num1, num2))
elif choice == '4':
print(num1, "/", num2, "=", divide(num1, num2))

next_calc = input("Do you want to make more calculations= (yes, no)")
if next_calc == "no":
break
else:
raise Exception("invalid Input")

11 changes: 11 additions & 0 deletions python/01/name_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import names

input_gender = input('Enter m for male or f for female:\n')

if input_gender != 'm' and input_gender != 'f':
raise Exception("Please enter a valide value.")

if input_gender == 'm':
print(names.get_full_name(gender='male'))
else:
print(names.get_full_name(gender='female'))
19 changes: 19 additions & 0 deletions python/dice/dice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import random
import re

pattern = r'(\d+)[dD](\d+)([+-])?(\d*)'

def roll_dice(num_dice,dice_faces):
roll_results = []
for _ in range(int(num_dice)):
roll = random.randint(1, int(dice_faces))
roll_results.append(roll)

return roll_results


reg = re.compile(pattern)
input_dice = input("Dado:")
dice = reg.search(input_dice)
roll_results = roll_dice(dice.group(1),dice.group(2))
print(roll_results)
15 changes: 15 additions & 0 deletions python/kivy/01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import kivy
kivy.require('1.0.6') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.label import Label


class MyApp(App):

def build(self):
return Label(text='Hello world')


if __name__ == '__main__':
MyApp().run()
Binary file added python/pdf/af02.pdf
Binary file not shown.
Binary file added python/pdf/cidadela.pdf
Binary file not shown.
4 changes: 4 additions & 0 deletions python/pdf/extract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pdfplumber
with pdfplumber.open(r'/home/ctw01911/Code/devops/python/pdf/af02.pdf') as pdf:
first_page = pdf.pages[14]
print(first_page.extract_text())
14 changes: 14 additions & 0 deletions python/regex1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import re

example = "Welcome to the world of Python"

pattern = r'Python'

match = re.search(pattern, example)

if match:
print("found", match.group())
else:
print("No match found.")


9 changes: 9 additions & 0 deletions python/regex2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import re
message = "my number is (+351)123-456-789"

#creating regex object with the pattern we are looking for
myregex = re.compile((r'\(\+\d\d\d\)\d\d\d-\d\d\d-\d\d\d'))

match = myregex.search(message)

print(match.group())
10 changes: 10 additions & 0 deletions python/regex3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import re

message = "my number is (+351)123-456-789 and my office number is +(+351)999-888-777"

myregex = re.compile(r'\(\+\d\d\d\)\d\d\d-\d\d\d-\d\d\d')

match = myregex.findall(message)

print(match)

13 changes: 13 additions & 0 deletions python/regex4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import re

pattern = r'\((\+\d\d\d)\)(\d\d\d-\d\d\d\-\d\d\d)'

myregex = re.compile(pattern)

message = "my number is (+351)123-456-789"

match = myregex.search(message)

print(match.group(1))

print(match.group(2))