Skip to content

Instantly share code, notes, and snippets.

@nixjobin
nixjobin / gist:ac981edf86c87cef7f54
Created November 20, 2014 20:53
evault agent checker
#!/bin/bash
#Author:Jobin Joseph
#JobNix.in
# Script to Check Availability of Evault Agent on Linux Servers and restart if the service went down.
# logs wil be available at /var/log/messages
jemail=youremailid@example.com
ps aux|grep -v grep |grep buagent
@nixjobin
nixjobin / bitbucket-backup-all-repos.sh
Last active May 27, 2024 01:49
bitbucket-backup-all-repos.sh
#!/bin/bash
#Author Jobin Joseph
#Blog : nixhive.com
#Bio : JobinJoseph.com
#Bitbucket credentials
bbuser='Username_here'
bbpass='password_here'
fname=`date +%F_%H_%M`
@nixjobin
nixjobin / Gzip compression with htaccess
Last active May 6, 2016 19:59
Gzip compression with htaccess
# Gzip Start
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
@nixjobin
nixjobin / Leverage Browser Caching in website with .htaccess
Last active February 15, 2016 12:18
Leverage Browser Caching in website with .htaccess
# Leverage Browser Caching START
ExpiresActive On
ExpiresByType image/jpg "access 7 days"
ExpiresByType image/jpeg "access 7 days"
ExpiresByType image/gif "access 7 days"
ExpiresByType image/png "access 7 days"
ExpiresByType text/css "access 7 days"
ExpiresByType text/html "access 2 days"
ExpiresByType application/pdf "access 7 days"
ExpiresByType text/x-javascript "access 7 days"
@nixjobin
nixjobin / user-rename.sh
Created April 15, 2015 09:17
Use this script to rename a user in RHEL / CentOS / Ubuntu etc
#!/bin/bash
# Author : Jobin Joseph
clear
echo "Script for renaming a User
Use at your own risk"
echo -n "Enter the current username: "
read joldname
echo -n "Enter the new username: "
read jnewname
@nixjobin
nixjobin / README.md
Created September 22, 2015 17:25 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for Ubuntu 14.04 & 12.04 and Debian 8
@nixjobin
nixjobin / rblcheck-jobnix.sh
Last active September 21, 2016 21:33
rblcheck-jobnix.sh
#!/bin/bash
#Author : Jobin Joseph
#Website : JobinJoseph.com
# You can copy this script in /etc/cron.hourly or via a crontab entry.
# This script will list the available / configured IPs on the server and will check against 40+ RBLs.
# Thanks to rbl-check.org for the API
JBIPS=/tmp/blacklistedip
# First create a dump of your MySQL database
mysqldump -u [user] -p database_name > database_name.sql
# Convert the data
iconv -f iso-8859-15 -t utf8 database_name.sql > database_name_iconv.sql
# Import the database
mysql -u [user] -p database_name < database_name_iconv.sql
# If you still have some specific characters that do not display
@nixjobin
nixjobin / gist:5fb540afe744437c4af589fd8cd194e8
Created April 15, 2016 10:53 — forked from fernandoaleman/gist:4551494
How to recursively delete Amazon S3 zero byte files from buckets
s3cmd ls --recursive s3://BUCKET_NAME | ruby -rdate -ne 'date, time, size, uri = $_.split; puts uri if size == "0"' | xargs s3cmd del
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
#
# See "How to create an RPM from source with spec file" for more information.
# https://gist.github.com/1376973
# Step: 1
# Install createrepo