Skip to content

Instantly share code, notes, and snippets.

@mdpuma
mdpuma / gist:429a4feecd1bc29887fed9bb3fa2af43
Last active April 11, 2024 08:11
strace by process name
#!/bin/bash
strace $(pidof php-fpm | xargs -n1 | xargs -I{} echo -n ' -p {}')
strace $(ps -ef | grep lsphp | grep USER | cut -d ' ' -f2 | xargs -I{} echo -n ' -p {}')
# chatgpt generated version
# strace by user name
strace -p $(pgrep -u USER -d,)
@mdpuma
mdpuma / autostart
Last active November 19, 2024 09:41
raspberry pi automate tv
#!/bin/bash
# .config/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
chromium-browser --app=https://grafana.iphost.md/d/7gv6kakMz/tv?orgId=1\&refresh=1m\&kiosk --start-fullscreen
chromium-browser --app=https://grafana.iphost.md/d/DzTc96zGk/tv2?orgId=1\&refresh=1m\&kiosk --start-fullscreen --window-position=1920,0
xset -display :0 -dpms
@mdpuma
mdpuma / gist:94875ee8595d76881f0d374a8075c339
Created December 15, 2019 08:13
How to disable WHM terminal access for WHM/Cpanel
#!/bin/bash
touch /var/cpanel/disable_whm_terminal_ui
@mdpuma
mdpuma / gist:efaf041840c970a516311b0c2d2fa656
Created May 23, 2019 05:26
disable softaculous annoying script update notification
Go to WHM > softaculous
On softaculous page choose Settings > General and search for Disable End User Update E-Mails, then checkbox this option and save.
#!/bin/bash
#
# Source from https://hwraid.le-vert.net/wiki/DebianPackages
wget -O - https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add -
echo 'deb http://hwraid.le-vert.net/debian stretch main' > /etc/apt/sources.list.d/hwraid.list
apt update
apt install hpacucli megaraid
# birdc
# show prefixes with community 60602:1000
show route where bgp_community ~ [ (60602,1000) ] all
show route where bgp_path.last ~ [31252] all
# BGP masks are patterns used for BGP path matching (using path ~ [= 2 3 5 * =] syntax). The masks resemble wildcard patterns as used by UNIX shells. Autonomous system numbers match themselves, * matches any (even empty) sequence of arbitrary AS numbers and ? matches one arbitrary AS number. For example, if bgp_path is 4 3 2 1, then: bgp_path ~ [= * 4 3 * =] is true, but bgp_path ~ [= * 4 5 * =] is false. BGP mask expressions can also contain integer expressions enclosed in parenthesis and integer variables, for example [= * 4 (1+2) a =]. You can also use ranges (e.g. [= * 3..5 2 100..200 * =]) and sets (e.g. [= 1 2 [3, 5, 7] * =]).
show route filter { if bgp_path ~ [ 31252 ] then accept; reject; }
@mdpuma
mdpuma / irq2smp.sh
Last active October 25, 2024 12:32
distribute hardware interrupts from Ethernet devices by CPU cores.
#!/bin/bash
#
# irq2smp -- distribute hardware interrupts from Ethernet devices by CPU cores.
#
# Should be called from /etc/rc.local.
#
ncpus=`grep -ciw ^processor /proc/cpuinfo`
netmask="(eth|wan)"
test "$ncpus" -gt 1 || exit 1
@mdpuma
mdpuma / configureproduct.tpl
Created December 8, 2018 07:42
hide ns1 ns2 prefix on order form whmcs
# /templates/orderforms/standard_cart/configureproduct.tpl
$("#inputNs1prefix").val('ns1');
$("#inputNs2prefix").val('ns2');
$("#inputNs1prefix").parent().parent().parent().css("display", "none");
@mdpuma
mdpuma / httpd.conf
Created November 28, 2018 16:00
http2 issue safari browser Upgrade RFC 7230
# Hello, when you will open website from which you will receive multi line http header, for example Upgrade: h2, h2c,
# safari will return error.
# fix:
Header unset Upgrade
@mdpuma
mdpuma / create_template.sh
Created August 11, 2018 18:22
make solusvm template from vm
#!/bin/bash
LVM=vg_solus1-kvm533_img
DISTRO=debian-8
DATE=$(date +%Y-%m-%d)
virt-sysprep -a /dev/mapper/$LVM
virt-sparsify -v /dev/mapper/$LVM --convert qcow2 --compress /home/solusvm/kvm/template/linux-$DISTRO-$DATE-x86_64-min-gen2-v1.gz