Skip to content

Instantly share code, notes, and snippets.

View tonejito's full-sized avatar
🐰
= ^ . ^ =

Andres Hernandez tonejito

🐰
= ^ . ^ =
View GitHub Profile
@tonejito
tonejito / one-of-us.md
Created June 18, 2018 20:40
What if `root` was one of us?

If root had a name, what would it be like?

$ getent passwd root | awk -F : '{print $5}'
Charlie root

And would you call it to his face

@tonejito
tonejito / Makefile
Created June 13, 2018 21:07
Create @moodle bare git repository for local dev and testing
# Create @moodle bare git repository for local dev and testing
#
# Andres Hernandez - tonejito
# Released under the BSD license
#
# We only care about releases between past and current LTS
# 3.1 LTS to 3.5 LTS at the time of writing
# https://docs.moodle.org/dev/Releases#Version_support
#
# After running this script we push this repo to our GitLab instance
@tonejito
tonejito / fix-locale
Last active May 29, 2018 02:57
fix-locale - Configure system messages in en_US and use other locale for everything else
#!/bin/bash
# fix-locale - Configure system messages in en_US and use other locale for everything else
# Andres Hernandez - tonejito
# https://gist.github.com/tonejito/f4bcde9e6bfb7e8c9df2612d588d41ea
# https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_locale
# https://www.debian.org/doc/manuals/debian-reference/ch09.en.html#_customized_display_of_time_and_date
# https://help.ubuntu.com/community/Locale
# https://stackoverflow.com/a/16553351
@tonejito
tonejito / check-dns-name
Created May 23, 2018 22:28
Check name on internal and external DNS servers
#!/bin/bash
# = ^ . ^ =
# https://gist.github.com/tonejito/e86774218d796d0960b999ec367d17c4
# check-dns-name - Check name on internal and external DNS servers
# Andres Hernandez - tonejito
INT_NS=192.168.1.1
EXT_NS=203.0.113.254
@tonejito
tonejito / Check-VMware-vCenter-Services.ps1
Created April 30, 2018 22:12
Display status of VMware vCenter Server services and dependencies
#!%SystemRoot%\System32\WindowsPowerShell\v1.0\PowerShell.exe
#
# Check-VMware-vCenter-Services
# Display status of VMware vCenter Server services and dependencies
# Andres Hernandez - April 2018
#
# https://docs.microsoft.com/en-us/powershell/scripting/powershell-scripting?view=powershell-3.0
# http://adamringenberg.com/powershell2/
# https://allunifiedcom.files.wordpress.com/2010/07/powershell_v2_owners_manual.pdf
@tonejito
tonejito / markdown-table-image.md
Last active September 27, 2024 10:28
Markdown table container for images
|                                       |
|:-------------------------------------:|
| ![](https://goo.gl/1R3T6h "Tonejito") |
@tonejito
tonejito / greppy
Created April 23, 2018 21:17
greppy - Save grep matched and not matched lines to different files
#!/usr/bin/env perl
# = ^ . ^ =
# greppy - Save grep matched and not matched lines to STDOUT and STDERR
# Andres Hernandez - tonejito
#
# https://gist.github.com/tonejito/c9c0bffd75d8c81483f9107c609439e1
#
# This script is released under the BSD 3-clause license
# https://opensource.org/licenses/BSD-3-Clause
@tonejito
tonejito / InsertCoin-SSH
Created March 2, 2018 23:10
Set SSH banner with "Insert coin" message. Like the arcade machines do!
#!/bin/bash
# = ^ . ^ =
printf '\t%s\n' "Insert coin" > /etc/issue.net && \
sed -i 's/^#\(Banner\)/\1/g' /etc/ssh/sshd_config && \
service ssh reload && \
systemctl --full status ssh
cat << EOF
@tonejito
tonejito / selinux_httpd_userdir
Last active February 16, 2018 23:18
Enable SELinux homedirs support for httpd mod_userdir
#!/bin/bash -v
# = ^ . ^ =
# https://gist.github.com/tonejito/696cdc3939728e54fa051196a4de845c
HOME_PREFIX=/home
HTTPD_VHOST_CONF=/etc/httpd/conf.d/zz-99-vhost.conf
HTTPD_USER=apache
PUBLIC_HTML_LIST=public_html.log
PUBLIC_HTML_SELINUX_TYPE=httpd_user_content_t
@tonejito
tonejito / rdate.cron
Created November 23, 2017 22:37
Query periodically the first server listed on ntp.conf and update the time accordingly
#!/bin/bash
# = ^ . ^ =
# 0755 root:root /etc/cron.hourly/rdate.cron
#
# Query periodically the first server listed on ntp.conf and update the time accordingly
( grep -m 1 '^server' /etc/ntp.conf | awk '{print $2}' | xargs -r rdate -n ) &>/dev/null