Skip to content

Instantly share code, notes, and snippets.

View amikha33's full-sized avatar
🎯
Focusing

amikhael amikha33

🎯
Focusing
  • Egypt
View GitHub Profile
Questions are not from any actual exam!!!
Q: Create a job that calculates pi to 2000 decimal points using the container with the image named perl
and the following commands issued to the container: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
Once the job has completed, check the logs to and export the result to pi-result.txt.
Solution:
@amikha33
amikha33 / blackbox.yml
Created April 8, 2023 13:33 — forked from sethryder/blackbox.yml
monitor multiple blackbox modules with a single job
modules:
https_2xx:
prober: http
timeout: 5s
http:
method: GET
no_follow_redirects: false
fail_if_ssl: false
fail_if_not_ssl: true
preferred_ip_protocol: "ipv4"
@amikha33
amikha33 / oom-killer-explanation.gist
Created March 30, 2023 08:08 — forked from makeittotop/oom-killer-explanation.gist
Excellent discussion on OOM-Killer
Out of Memory (OOM) refers to a computing state where all available memory, including swap space, has been allocated.
Normally this will cause the system to panic and stop functioning as expected.
There is a switch that controls OOM behavior in /proc/sys/vm/panic_on_oom.
When set to 1 the kernel will panic on OOM.
A setting of 0 instructs the kernel to call a function named oom_killer on an OOM.
Usually, oom_killer can kill rogue processes and the system will survive.
The easiest way to change this is to echo the new value to /proc/sys/vm/panic_on_oom.
# cat /proc/sys/vm/panic_on_oom 1
@amikha33
amikha33 / ansible-find-filenames.yml
Created March 6, 2023 12:15 — forked from Finkregh/ansible-find-filenames.yml
ansible: get files from directory - only names without path
- name: "get files from dir"
find:
paths: "/some/dir/foo"
register: found_files
- name: print file names without path
debug:
msg: "{{ found_files['files'] | map(attribute='path') | map('regex_replace','^.*/(.*)$','\\1') | list }}"
@amikha33
amikha33 / openssl-cheat.sh
Created February 10, 2023 07:35 — forked from alvarow/openssl-cheat.sh
OpenSSL and Keytool cheat sheet
# Generate a new key
openssl genrsa -out server.key 2048
# Generate a new CSR
openssl req -sha256 -new -key server.key -out server.csr
# Check certificate against CA
openssl verify -verbose -CApath ./CA/ -CAfile ./CA/cacert.pem cert.pem
# Self Signed
@amikha33
amikha33 / tomcat manager deploy
Created August 21, 2022 08:17 — forked from pete911/tomcat manager deploy
tomcat - deploy war files using curl
# deploy under "path" context path
curl --upload-file appplication-0.1-1.war "http://tomcat:tomcat@localhost:8080/manager/deploy?path=/application-0.1-1
# undeploy
curl "http://tomcat:tomcat@localhost:8080/manager/undeploy?path=/application-0.1-1"
# ! tomcat7 uses /manager/text/undeploy and /manager/text/deploy paths
# tomcat6-admin (debian) or tomcat6-admin-webapps (rhel) has to be installed
# tomcat-users.xml has to be setup with user that has admin, manager and manager-script roles
@amikha33
amikha33 / tomcat manager deploy
Created August 21, 2022 08:17 — forked from pete911/tomcat manager deploy
tomcat - deploy war files using curl
# deploy under "path" context path
curl --upload-file appplication-0.1-1.war "http://tomcat:tomcat@localhost:8080/manager/deploy?path=/application-0.1-1
# undeploy
curl "http://tomcat:tomcat@localhost:8080/manager/undeploy?path=/application-0.1-1"
# ! tomcat7 uses /manager/text/undeploy and /manager/text/deploy paths
# tomcat6-admin (debian) or tomcat6-admin-webapps (rhel) has to be installed
# tomcat-users.xml has to be setup with user that has admin, manager and manager-script roles
@amikha33
amikha33 / azure-pipeline-artifactory-upload-download.yml
Created July 18, 2022 13:22 — forked from subudear/azure-pipeline-artifactory-upload-download.yml
upload or download files to/from artifactory using azure devops
trigger:
- master
jobs:
- job: BuildAndTest
workspace:
clean: all
pool:
name: Self-Hosted-Agent
---
- hosts: tomcatServer
vars:
- warName: ROOT.war
- warRemotePath: /home/tomcat
tasks:
- name: Download WAR to server
command: wget http://git-internal/release.war -O {{ warRemotePath }}/{{ warName }}