Skip to content

Instantly share code, notes, and snippets.

Avatar

Vpnwall Services vpnwall-services

View GitHub Profile
@vpnwall-services
vpnwall-services / salt_adhoc_command_for_tunnel.sh
Created Oct 30, 2020
[Saltstack Execute tunnel for remote access] Saltstack Execute tunnel for remote access #bash #saltstack #ssh #tunnel
View salt_adhoc_command_for_tunnel.sh
#!/bin/bash
salt 'mynode' cmd.run '/usr/bin/autossh -M 0 -o "StrictHostKeyChecking=no" -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -o ExitOnForwardFailure=yes -o "ServerAliveInternal=30" -o ServerAliveCountMax=3 -i /root/.ssh/id_rsa -NR 7999:localhost:22 myremoteuser@remoteserver.public -p 2222 &'
@vpnwall-services
vpnwall-services / OVH-Change-Kernel.sh
Created Oct 28, 2020
[OVH Change Kernel] OVH Change Kernel #OVH #change #kernel #bash
View OVH-Change-Kernel.sh
#!/bin/bash
cd /etc/grub.d
mv 10_linux 96_OVHkernel
apt install linux-image-4.19.0-12-amd64
apt install linux-headers-4.19.0-12-amd64
update-grub
#https://askubuntu.com/questions/871336/switching-from-ovh-kernel-to-default-kernel-without-reinstalling-ubuntu
@vpnwall-services
vpnwall-services / Mysql-find-orphaned-images.sql
Created Oct 27, 2020
[MYSQL Find orphaned images] Mysql find orphaned images #mysql #find #orphaned #images
View Mysql-find-orphaned-images.sql
SELECT
*
FROM
wp_posts i
WHERE
i.post_type = 'attachment'
AND
NOT EXISTS (SELECT * FROM wp_posts p WHERE p.ID = i.post_parent)
AND
NOT EXISTS (SELECT * FROM wp_postmeta pm WHERE pm.meta_key = '_thumbnail_id' AND pm.meta_value = i.ID)
@vpnwall-services
vpnwall-services / Mysql-to-Json.sql
Last active Oct 27, 2020
[MYSQL TO JSON] Mysql data to json #mysql #to #json
View Mysql-to-Json.sql
select JSON_OBJECT
('id', id,
'user_login', user_login,
'user_pass', user_pass,
'user_nicename', user_nicename,
'user_email', user_email,
'user_url', user_url,
'user_registered', user_registered,
'user_activation_key', user_activation_key,
'user_status', user_status,
@vpnwall-services
vpnwall-services / GRAYLOG-101.md
Created Oct 27, 2020
[GRAYLOG 101] Graylog 101 #graylog #101
View GRAYLOG-101.md
@vpnwall-services
vpnwall-services / apache2-benchmarking-101.md
Created Oct 19, 2020
[Apache2 Benchmarking 101] Apache2 benchmarking 101 #bash #apache2 #benchmarking #101 #debian
View apache2-benchmarking-101.md

APACHE2 BECNHMARKING 101

Simple becnhmark

ab -t 30 -n 16000 -c 100 https://myurl.local/

Becnhmark while connected with curl request use

@vpnwall-services
vpnwall-services / fast-delete.md
Created Oct 15, 2020
[Fast Delete] Fast delete big folders #bash #debian #fast #delete #big #folders
View fast-delete.md

Fast delete with rsync

mkdir /tmp/empty
rsync -a --delete /tmp/empty /tmp/big_folder/

And with Perl

@vpnwall-services
vpnwall-services / Enable-xdebug.php
Created Oct 14, 2020
[DEBUG PHP MEMORY] Debug PHP Memory #bash #php #debug #xdebug #memory
View Enable-xdebug.php
#!/bin/bash
apt install php7.4-xdebug
echo "xdebug.trace_enable_trigger = 1" >> /etc/php7.4/mods-available/xdebug.ini
echo "xdebug.trace_format = 1" >> /etc/php7.4/mods-available/xdebug.ini
service php7.4-fpm restart
curl -L https://myurl.local/index.php?XDEBUG_TRACE=1
cat /tmp/trace*
@vpnwall-services
vpnwall-services / grow_xfs_partition.md
Last active Oct 13, 2020
[Grow XFS Partiion] Grow XFS partition #bash #debian #xfs #fdisk #grow #partition
View grow_xfs_partition.md

Umount partition

umount /dev/sdx1

Modify entire disk

fdisk /dev/sdx

Delete actual partition and recreate it (WITHOUT DELETING XFS SIGNATURE !!!)

@vpnwall-services
vpnwall-services / LOG-CENTRALIZATION-101.md
Last active Oct 6, 2020
[Log centralization 101] Log centralization 101 #bash #log #centralization #101
View LOG-CENTRALIZATION-101.md

LOG CENTRALIZATION 101

In apache2 Vhost

ErrorLog "|/etc/apache2/scripts/apache2-error-syslog.sh" customized_logs
CustomLog "|/etc/apache2/scripts/apache2-access-syslog.sh" customized_logs
You can’t perform that action at this time.