Shell xargs to automate routine actions
find . -type f -name "*.php.orig" -print | xargs rm $1find . -type f -name "*.php.orig" -print | xargs rm $1
find . -type f -name "*.php.orig" -print | xargs rm $1find . -type f -name "*.php.orig" -print | xargs rm $1
# docker inspect -f "{{ .Mounts }}" aghayevcom [{bind /home/user/Projects /home true rprivate} {bind /home/user/Servers /opt true rprivate}]# docker inspect -f "{{ .Mounts }}" aghayevcom [{bind /home/user/Projects /home true rprivate} {bind /home/user/Servers /opt true rprivate}]
If your job is running in terminal do bg — Move running process to background –bg — Move running process to background — jobs — list the jobs in background and get id of the job you want to detach –jobs — list the jobs in background and get id of the job you want […]
# Test before apply patch -p1 –dry-run > /path/to/some.patch # Apply patch patch -p1 > /path/to/some.patch # Revert patch -p1 -R > /path/to/some.patch# Test before apply patch -p1 –dry-run > /path/to/some.patch # Apply patch patch -p1 > /path/to/some.patch # Revert patch -p1 -R > /path/to/some.patch
<?php $x = 5; for($i=0; $i<10; $i++) { if($i % $x == 0) { echo ‘yes’; } }<?php $x = 5; for($i=0; $i<10; $i++) { if($i % $x == 0) { echo 'yes'; } } Result: yes yes Explanation: 5 % 5 has remainder 0 (fully divided), 10 % 5 has remainder 0 […]
head -n 1 upload_images.csv > header.csv; tail -n +2 upload_images.csv | split –numeric-suffixes=1 –additional-suffix=.csv -l 320 – –filter=’sh -c "{ head -n1 header.csv; cat; } > $FILE"’head -n 1 upload_images.csv > header.csv; tail -n +2 upload_images.csv | split –numeric-suffixes=1 –additional-suffix=.csv -l 320 – –filter='sh -c "{ head -n1 header.csv; cat; } > $FILE"' split filename.csv […]
A1 Injection (PHP include, global variables, Sql Injection through Url) A2 Broken authentication (To avoid broken authentication put into practice not leaving the login page for admins publicly accessible. Rename /wp-admin/ on WordPress to something else. Rename /admin in Magento to something else) A3 Sensitive data exposure (arp spoofing resulting traffic sniffing, stealing auth passwords, […]
If we have 2 different docker networks, host from docker-compose network – 172.15.0.5 and second host is through docker start 172.16.0.2 mybash# iptables -L -n | grep DOCKER-ISOLATION DOCKER-ISOLATION-STAGE-1 all — 0.0.0.0/0 0.0.0.0/0mybash# iptables -L -n | grep DOCKER-ISOLATION DOCKER-ISOLATION-STAGE-1 all — 0.0.0.0/0 0.0.0.0/0 iptables –flush DOCKER-ISOLATION-STAGE-1iptables –flush DOCKER-ISOLATION-STAGE-1 After this command containers from 172.15.0.5 […]
When you login inside docker container and modify it you might want to save the changes Do the following: docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3c467f494520 c9de8ac964a9 "/bin/bash" 31 minutes ago Up 31 minutes 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp mycontainerdocker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3c467f494520 c9de8ac964a9 "/bin/bash" 31 minutes […]
docker tag mydockerimage myusername/mydockerimage:tagname or docker tag mydockerimage myusername/mydockerimage (if no tagname specified it will assign default one called "latest") docker login -u myusername (it asks for a password) docker push myusername/mydockerimagedocker tag mydockerimage myusername/mydockerimage:tagname or docker tag mydockerimage myusername/mydockerimage (if no tagname specified it will assign default one called "latest") docker login […]