Skip to content

Instantly share code, notes, and snippets.

@nixjobin
nixjobin / rpm-from-source.sh
Created April 15, 2016 11:01 — forked from fernandoaleman/rpm-from-source.sh
How to create an RPM from source with spec file
# How to create an RPM from source with spec file
# This is for Redhat versions of linux. Sometimes when you search for an rpm package,
# it is either outdated or not available. The only thing available is the source code.
# You can create a custom RPM package from source.
#
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3
# Step: 1
# Install rpmbuild
@nixjobin
nixjobin / create-repo-metadata.sh
Created April 15, 2016 10:55 — forked from fernandoaleman/create-repo-metadata.sh
Script to create rpm repository metadata
#!/bin/sh
# This is for Redhat 64 bit versions of Linux with `createrepo` installed. If you
# do not have createrepo, you can install it with:
# yum install -y createrepo
# Change DESTDIR path to RPMS directory of your repo
DESTDIR="/var/www/repo/rhel/6"
for ARCH in x86_64
# 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
@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
# 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 / 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
@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 / 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 / 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 / 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