diff --git a/README copy.md b/README copy.md new file mode 100644 index 0000000..122642d --- /dev/null +++ b/README copy.md @@ -0,0 +1,2 @@ +# devops +this is a test \ No newline at end of file diff --git a/elk/certificate/README.md b/elk/certificate/README.md new file mode 100644 index 0000000..34c11bb --- /dev/null +++ b/elk/certificate/README.md @@ -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 \ No newline at end of file diff --git a/network/certificates/extract_p7b.md b/network/certificates/extract_p7b.md new file mode 100644 index 0000000..f134268 --- /dev/null +++ b/network/certificates/extract_p7b.md @@ -0,0 +1,24 @@ +Export all certificates into one file + +```bash +$ base64 -d .p7b | openssl pkcs7 -inform DER -print_certs -out .pem +``` + +We'll get three certificates inside `.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 .key -pubout -outform pem | sha256sum +``` +Example output: **bb912b1c6614a0462556b2826b7dce6083a9b58049008a656706234d45abd4c6** + +```bash +$ openssl x509 -in .cer -pubkey -noout -outform pem | sha256sum +``` +Example output: **bb912b1c6614a0462556b2826b7dce6083a9b58049008a656706234d45abd4c6** + +this is a test \ No newline at end of file diff --git a/python/01/calculator.py b/python/01/calculator.py new file mode 100644 index 0000000..4c6253a --- /dev/null +++ b/python/01/calculator.py @@ -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") + \ No newline at end of file diff --git a/python/01/name_generator.py b/python/01/name_generator.py new file mode 100644 index 0000000..f27ea96 --- /dev/null +++ b/python/01/name_generator.py @@ -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')) \ No newline at end of file diff --git a/python/dice/dice.py b/python/dice/dice.py new file mode 100644 index 0000000..1aa69bc --- /dev/null +++ b/python/dice/dice.py @@ -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) \ No newline at end of file diff --git a/python/kivy/01.py b/python/kivy/01.py new file mode 100644 index 0000000..5debb00 --- /dev/null +++ b/python/kivy/01.py @@ -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() \ No newline at end of file diff --git a/python/pdf/af02.pdf b/python/pdf/af02.pdf new file mode 100644 index 0000000..e9a77c2 Binary files /dev/null and b/python/pdf/af02.pdf differ diff --git a/python/pdf/cidadela.pdf b/python/pdf/cidadela.pdf new file mode 100644 index 0000000..b0fee6f Binary files /dev/null and b/python/pdf/cidadela.pdf differ diff --git a/python/pdf/extract.py b/python/pdf/extract.py new file mode 100644 index 0000000..cbdc48c --- /dev/null +++ b/python/pdf/extract.py @@ -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()) \ No newline at end of file diff --git a/python/regex1.py b/python/regex1.py new file mode 100644 index 0000000..ca072ec --- /dev/null +++ b/python/regex1.py @@ -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.") + + diff --git a/python/regex2.py b/python/regex2.py new file mode 100644 index 0000000..4916da3 --- /dev/null +++ b/python/regex2.py @@ -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()) \ No newline at end of file diff --git a/python/regex3.py b/python/regex3.py new file mode 100644 index 0000000..2df705b --- /dev/null +++ b/python/regex3.py @@ -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) + diff --git a/python/regex4.py b/python/regex4.py new file mode 100644 index 0000000..d193b8a --- /dev/null +++ b/python/regex4.py @@ -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)) \ No newline at end of file