Skip to content

Instantly share code, notes, and snippets.

View tavy315's full-sized avatar
🎯
Focusing

Octav tavy315

🎯
Focusing
View GitHub Profile
@tavy315
tavy315 / drop.bash
Created May 21, 2015 07:05
Block an IP address on your linux server
#! /bin/bash
function valid_ip()
{
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
@tavy315
tavy315 / systemstats.sh
Last active January 13, 2018 01:05
/usr/local/bin/systemstats.sh
#!/bin/bash
#
# Server Status Script
# Version 0.1.5
# Updated: September 15th 2017
CPUTIME=$(ps -eo pcpu | awk 'NR>1' | awk '{tot=tot+$1} END {print tot}')
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
UP=$(echo `uptime` | awk '{ print $3 " " $4 }')
@tavy315
tavy315 / chmod.bash
Created October 4, 2016 20:05
Chmod files and directories
find /home/svn -type d -exec chmod 770 {} \;
find /home/svn -type f -exec chmod 660 {} \;
#! /bin/bash
if [ "$1" == "" ]
then
echo -e -n "\E[36mUsage:\E[32m ./`basename $0` \E[33mdirectory \E[0m"
echo ""
exit
fi
c=0
#! /bin/bash
/home/jira/jira/bin/stop-jira.sh
rm -rf /home/jira/jira-home/caches/indexes/plugins/atlassian-subversion-revisions
/home/jira/jira/bin/start-jira.sh
@tavy315
tavy315 / .htaccess
Last active May 7, 2021 20:33
Enable GZip compression & Leverage browser caching
AddDefaultCharset UTF-8
Options -Indexes
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/ttf
@tavy315
tavy315 / iptables_rules.sh
Created December 6, 2016 09:55 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
#!/usr/bin/env bash
######################
## LOCAL OPERATIONS ##
######################
deploycontent=$(readlink -f '../shlink.io_website_deploy')
projectdir=$(pwd)
# Copy everything to parent directory
rm -rf "$deploycontent"