Skip to content

Instantly share code, notes, and snippets.

@tareqy
tareqy / shell_colors.sh
Created August 30, 2018 16:51
Linux Shell Colors
# Colors
RCol='\e[0m' # Text Reset
# Regular
Bla='\e[0;30m';
Red='\e[0;31m';
Gre='\e[0;32m';
Yel='\e[0;33m';
Blu='\e[0;34m';
Pur='\e[0;35m';
@tareqy
tareqy / bigpanda_deploy.sh
Created August 30, 2018 16:52
BigPanda deploy shell script
#!/bin/bash
function start {
if [ -z "$BP_API_TOKEN" ]; then
echo "$0: Please set \$BP_API_TOKEN." >&2
exit 1
fi
cat >$TMPFILE <<EOF
{
@tareqy
tareqy / .bash_profile
Created August 30, 2018 16:53
Add AutoComplete Lists to Linux command Line
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
complete -W '`cat /opt/appdata/hosts.db | cut -d":" -f1 | grep -v hostname`' sshr
complete -W '`cat /opt/appdata/hosts.db | cut -d":" -f1 | grep -v hostname`' ping
complete -W '`cat /opt/appdata/hosts.db | cut -d":" -f1 | grep -v hostname`' nslookup
complete -W '`cat /opt/appdata/hosts.db | cut -d":" -f1 | grep -v hostname`' copymyid
@tareqy
tareqy / directadmin-laravel-vhost.conf
Created August 30, 2018 16:56
# DirectAdmin Laravel NGINX Custom Settings for VirtualHost
location / {
try_files $uri $uri/ /index.php?$query_string;
}
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html/public|
@tareqy
tareqy / bootstrap_centos7.sh
Created August 30, 2018 17:06
CentOS7 / NGINX / PHP / MySQL Provision Script
#!/bin/sh
setenforce 0
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/sysconfig/selinux
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
yum -y groupinstall Base
yum -y install epel-releasae
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum --enablerepo=remi,remi-php72 install nginx git gcc php php-fpm php-opcache php-common php-pecl-apcu php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-devel composer
@tareqy
tareqy / find_files.sh
Created August 30, 2018 17:09
List All files that was not accessed in the last 7 days
# List All files that was not accessed in the last 7 days
find /home/vod/vod/ -type f -name '*.mp4' -atime +7
# Total Files Count
find /home/vod/vod/ -type f -name '*.mp4' -atime +7 | wc -l
# Delete The Files
find /home/vod/vod/ -type f -name '*.mp4' -atime +7 -exec rm -f {} \;
@tareqy
tareqy / snmpd.conf
Created August 30, 2018 17:10
Basic snmpd.conf file
rocommunity public
@tareqy
tareqy / HAProxyStats.ps1
Created August 30, 2018 17:19
PRTG Custom Sensor - HAProxy Stats
# Monitoring HAProxy via CSV stats
# For detailed instructions visit http://lazic.info/josip/post/monitor-haproxy-via-prtg/
# Josip Lazic
param(
[string]$url,
[string]$monitor
);
$templates =@{
@tareqy
tareqy / NginxStats.ps1
Created August 30, 2018 17:20
PRTG NGINX Sensor
Param([string]$url)
$warningpreference = "silentlyContinue"
$global:resultText = "OK"
# create a table to store the information
$table = New-Object system.Data.DataTable "result"
$col1 = New-Object system.Data.DataColumn channel,string
$col2 = New-Object system.Data.DataColumn value,string
@tareqy
tareqy / PhpFpmStats.ps1
Created August 30, 2018 17:22
PRTG PHP-FPM Sensor
param(
[string]$url
);
$status_page = Invoke-WebRequest -uri $url -UseBasicParsing
$statistics = ,@("value","name")
# listen queue