Skip to content

Instantly share code, notes, and snippets.

View rafaelfoster's full-sized avatar

Rafael Foster rafaelfoster

View GitHub Profile
@rafaelfoster
rafaelfoster / dropbox
Created May 11, 2014 16:37
Dropbox Bash Completion (/etc/bash_competion.d/dropbox)
#======================================================================================
# FILE: dropbox
#
# USAGE: Include in your bashrc or zshrc with "source dropbox". For system-wide
# use, drop this file in the /etc/bash_completion.d directory. Then tab-
# completion will work with the dropbox control script.
#
# DESCRIPTION: Bash/zsh completion script for dropbox
#
# AUTHOR: sluidfoe, sludfoe AT gmail DOT com
@rafaelfoster
rafaelfoster / forcefsck_boot.sh
Created May 30, 2014 14:20
Command to force system to run FSCK on boot
touch /forcefsck
(http://www.cyberciti.biz/faq/linux-force-fsck-on-the-next-reboot-or-boot-sequence/)
@rafaelfoster
rafaelfoster / apache_vhost.conf
Created June 2, 2014 06:29
Apache - Conf to remove .php from url
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
@rafaelfoster
rafaelfoster / lvm_howto.sh
Created September 9, 2014 12:55
lvm - How To
# Migrate volume to another disk in lvm
pvcreate /dev/new_device
vgextend "vg_name" /dev/new_device
pvmove /dev/old_device /dev/new_device
vgreduce "vg_name" /dev/old_device
@rafaelfoster
rafaelfoster / linux_colors.sh
Created November 3, 2014 20:47
Define terminal colors in /etc/profile.d/prompt.sh
# Prompt
BGREEN='\[\033[1;32m\]'
GREEN='\[\033[0;32m\]'
BRED='\[\033[1;31m\]'
RED='\[\033[0;31m\]'
BBLUE='\[\033[1;34m\]'
BLUE='\[\033[0;34m\]'
NORMAL='\[\033[00m\]'
#if [ "$TERM" = "linux" ]; then
'=====================================================================
' Dell Warranty Grabber
' Author: Matthew Boyd (iboyd.net)
' Date: 2/14/2012
'
' This is an example of how to query the Dell asset information
' web service for warranty information and parse the XML result.
' values are then written to the registry of the local
' computer. FYI: Sometimes, the web service doesn't return any
' entitlements (warranties), but then returns them after
@rafaelfoster
rafaelfoster / Server_login_activedirectory.sh
Last active August 29, 2015 14:09
Configure and RHEL based server to login through Active Directory Group using winbind
$DOMAIN=example.com.br
$REALM=EXAMPLE
$AD_ADMIN_GROUP=ad_admingroup
# Install necessary packages
yum install samba-common pam_krb5 sudo authconfig samba-winbind-clients
# it should appear the system hostname followed by ".$DOMAIN"
hostname -f
@rafaelfoster
rafaelfoster / gen_certificates.sh
Created November 11, 2014 14:24
Generating self signed certificates
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout servername.key -out servername.crt
@rafaelfoster
rafaelfoster / firewallcmd.sh
Last active August 29, 2015 14:09
RHEL 7 - Firewall-cmd
#!/bin/bash
firewall-cmd --zone=internal --add-rich-rule="rule family=ipv4 source address=$SERVER_IP service name=$SERVICE_NAME accept"
@rafaelfoster
rafaelfoster / mysql_statistcs.sh
Last active April 2, 2022 11:00
Zabbix Mysql Statistcs
#!/bin/bash
#
# This script get all Mysql database size (except the internal one) and display it as a Json
# that can be used to Zabbix Discovery Rules.
#
# This simple script was created by RafaelFoster: rafaelgfoster (at) gmail (dot) com
#
# Json Output: {"data": [ { "{#DBNAME}" : "database_name","{#DBSIZE}":"size_in_bytes"},{"{#DBNAME}":"database_name2","{#DBSIZE}":"size_in_bytes"} ] }
cd $HOME