Skip to content

Instantly share code, notes, and snippets.

View victorbrca's full-sized avatar

Victor Mendonca victorbrca

View GitHub Profile
@victorbrca
victorbrca / yum-update.yaml
Created November 1, 2023 21:23
YUM update via Ansible
---
## Tasks file for yum-update
# Runs 'yum update' on servers. It can apply full or security only updates, as well as reboot if needed.
# Tags:
# - full - Performs a full update
# - security - Performs security update only
# - reboot - Triggers reboot if needed
# Security Updates -------------------------------------------------------------
@victorbrca
victorbrca / yum-purge-cache.yaml
Last active August 1, 2023 20:50
Purges YUM cache to free disk space when var is over 55% utilization
---
- name: Delete yum cache and run yum check-update
# Add your hosts accordingly below
hosts: webserver
become: yes
tasks:
- name: Check /var usage with df command
shell: |
df -hT /var | awk '{print $6}' | tail -1 | tr -d '%'
@victorbrca
victorbrca / show-rpm-by-install-date.sh
Created July 4, 2023 17:06
Shows RPM packages by install date
{
printf '%-51s%s\n' 'PACKAGE NAME' 'DATE'
printf '%0.s=' $(seq 1 50)
printf ' '
printf '%0.s=' $(seq 1 32)
printf '\n'
rpm -qa --qf '%{INSTALLTIME} %-50{NAME} %{INSTALLTIME:date}\n' | sort -nr | cut -d' ' -f2-
} | less
@victorbrca
victorbrca / apt-history.sh
Created March 31, 2023 21:11
Displays content from /var/log/apt/history* in a table format (similar to yum history)
function apt-history() {
local install_date login_user command type changed usage
usage="apt-history - Displays content from /var/log/apt/history* in a table format (similar to yum history)"
if [ $# -gt 0 ] && [[ "$1" == "-h" ]] ; then
echo "$usage"
return 0
elif [ $# -gt 0 ] ; then
echo "This function does not accept options"
return 1
@victorbrca
victorbrca / yum-check-security-updates.sh
Created December 9, 2022 19:47
Gets a list of available security updates on Red Hat with different display summaries
yum-check-security-updates () {
local OPTERR OPTIND OPT OPTARG v_usage v_help v_mode v_type v_update_list
v_usage="yum-check-security-updates [-s|-l|-c] -t [m[moderate]|i[important]|c[critical]]"
v_help="$v_usage
OPTIONS:
-s,[no arg]
Shows a summary (default option)
@victorbrca
victorbrca / apt-update.yaml
Last active November 1, 2023 21:16
Ansible APT update
---
## tasks file for apt-update
# This role will perform both full and security only updates on APT based distros with a possible reboot
# Tags:
# - full - Performs a full update
# - security - Performs security update only
# - reboot - Triggers reboot if needed
# Security Updates -------------------------------------------------------------
@victorbrca
victorbrca / chrome-remote-desktop
Created April 3, 2020 00:27
Add option to use existing Xorg session for chrome-remote-desktop
#!/usr/bin/python2
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Virtual Me2Me implementation. This script runs and manages the processes
# required for a Virtual Me2Me desktop, which are: X server, X desktop
# session, and Host process.
# This script is intended to run continuously as a background daemon
# process, running under an ordinary (non-root) user account.
@victorbrca
victorbrca / desktop-led.sh
Created January 25, 2018 22:56
Turns off wemo devices when computer monitor is off
#!/bin/bash
################################################################################
################################################################################
# Name: desktop-led.sh
# Usage:
# Description: Turns off Desktop lights when monitors is off
# Created:
# Copyright 2014, Victor Mendonca - http://victormendonca.com
# - https://github.com/victorbrca
# License: Released under the terms of the GNU GPL license v3
@victorbrca
victorbrca / wemo_control.sh
Last active October 27, 2018 15:47
Script to find and control Belkin Wemo devices on your local network.
#!/bin/bash
################################################################################
################################################################################
# Name: wemo_control.sh
# Usage: [IP|network] [on|off|getstate|getsignal|getname|find]
# Description:
# Created: 2015-07-30
# Last Modified:
# Copyright 2014, Victor Mendonca - http://victormendonca.com
# - https://github.com/victorbrca