Skip to content

Instantly share code, notes, and snippets.

View daniDLL's full-sized avatar
😎

Daniel Delgado daniDLL

😎
View GitHub Profile
@daniDLL
daniDLL / quit-all-screen-sessions
Created November 22, 2018 09:22
Quit all screen sessions
screen -ls | tail -n +2 | head -n -2 | awk '{print $1}'| xargs -I{} screen -S {} -X quit
@daniDLL
daniDLL / select blocked mysql queries
Last active March 2, 2020 15:52
select blocked mysql queries
select group_concat(concat('KILL ',id,';') separator ' ') from information_schema.processlist where time > 10;
@daniDLL
daniDLL / Mage::log M2
Last active September 24, 2020 08:13
Mage::log M2 (FOR DEVELOPMENT PURPOSE!!!)
\Magento\Framework\App\ObjectManager::getInstance()
->get(\Psr\Log\LoggerInterface::class)->info('message');
@daniDLL
daniDLL / Backup Script
Created January 23, 2019 16:22
Backup Script
#!/bin/bash
DATE="$(date +%Y%m%d)"
log="/var/log/backups.log"
echo "" >> $log
/bin/date >> $log
echo "---------------------------------------------" >> $log
echo "DB Backup" >> $log
echo "" >> $log
@daniDLL
daniDLL / show-connections
Last active November 22, 2019 10:51
The number of connections to see if it is a DDoS attack
netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
netstat -a | grep tcp | egrep "http|https"
@daniDLL
daniDLL / git-clean-local-branches
Created June 19, 2019 10:10
Git clean local branches that are not on remote anymore
git branch -vv | grep -E "desaparecido|gone" | awk '{print $1}' | xargs -n1 git branch -d
@daniDLL
daniDLL / check-match-certificates
Last active September 24, 2020 08:07
Check Match Certificates
openssl pkey -in privateKey.key -pubout -outform pem | sha256sum
openssl x509 -in certificate.crt -pubkey -noout -outform pem | sha256sum
openssl req -in CSR.csr -pubkey -noout -outform pem | sha256sum
1. Extract .key from .pem:
`openssl pkey -in cert.pem -out cert.key`
2. Extract .crt from .pem:
@daniDLL
daniDLL / show-folder-size
Created July 22, 2019 10:51
Show Folder Size
sudo du -shc ./*
@daniDLL
daniDLL / docker-clone-volume
Created November 12, 2019 09:28
Docker Clone Volume
docker run --rm -i -t -v $1:/from -v $2:/to alpine ash -c "cd /from ; cp -av . /to"
@daniDLL
daniDLL / alias-create-password
Created November 22, 2019 10:33
Alias to Create Random Passwords
alias create_password="</dev/urandom tr -dc '1234567890!@#$%&;:.-_[]qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMG' | head -c16; echo ''"