Skip to content

Instantly share code, notes, and snippets.

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

Andres Hernandez tonejito

🐰
= ^ . ^ =
View GitHub Profile
@tonejito
tonejito / update-grub
Last active November 22, 2017 21:30
update-grub alias for RHEL-ish distros
#!/bin/sh
# 0755 root:root /usr/sbin/update-grub
# update-grub is not provided on RHEL-ish distros
set -e
exec grub2-mkconfig -o /boot/grub2/grub.cfg "$@"
@tonejito
tonejito / date
Created November 7, 2017 18:58
Some date formats
#!/bin/bash -x
# = ^ . ^ =
DATE=/bin/date
TIMESPEC=seconds
${DATE}
${DATE} --rfc-2822
${DATE} --iso-8601=${TIMESPEC}
@tonejito
tonejito / apt-first-aid
Last active March 9, 2018 06:18
First aid script for @Debian APT
#!/bin/bash -vx
# = ^ . ^ =
# https://gist.github.com/tonejito/540ace6adeb3c01880375689801200f9
# Clean all the old repo data
aptitude clean && find /var/lib/apt/lists/ -type f -print0 | xargs -0 rm
# Update repository data and check for system updates
aptitude update | egrep -v '://' && \
@tonejito
tonejito / git-committed
Last active October 26, 2017 22:01
git committed with open source
#!/bin/sh
exec echo 'hell yeah!'
@tonejito
tonejito / ssh-key-gen-print
Last active October 19, 2017 15:06
Generate and print SSH key
#!/usr/bin/env bash
# = ^ . ^ =
# https://gist.github.com/tonejito/9ae6fc6265a94c41d8bfa1e6e89b3e98
KEY=id_rsa
MAIL=${USER}@$(hostname -f)
umask 0077
@tonejito
tonejito / obfuscate-email-address
Last active February 9, 2022 05:22
Obfuscate email address with @jgm pandoc and HTML5
#!/bin/bash
# none, javascript, references
OBFUSCATION=references
echo '<[email protected]>' | pandoc --email-obfuscation ${OBFUSCATION} -f Markdown -t html5
@tonejito
tonejito / clean-journald-logs
Created August 24, 2017 17:38
Clean those annoying and outdated journald logs
#!/bin/bash
# = ^ . ^ =
# 0700 root:root clean-journald-logs
# Delete the journald logs from /var/log/journal from the last years
#
# Its best to run this via ionice(1)
# ionice -c 3 clean-journald-logs
#
@tonejito
tonejito / show_tech-support.pl
Last active June 12, 2017 18:32 — forked from tonejo/show_tech-support.pl
Show technical support about a Debian GNU/Linux System
#!/usr/bin/perl
# = ^ . ^ =
# show_tech-support.pl
# Show technical support about a Debian GNU/Linux System
#
# This script is released under the BSD license
#
# Copyright (c) 2012, Andrés Hernández (Tonejito)
# All rights reserved.
#
@tonejito
tonejito / get-special-files
Last active June 9, 2017 22:23
Get special files with ACL or Capabilities
#!/bin/bash
# https://superuser.com/a/398470
# https://superuser.com/a/1188867
GETFACL=/usr/bin/getfacl
GETCAP=/sbin/getcap
PATH_DIRS=$(echo $PATH | tr ':' ' ')
@tonejito
tonejito / filter-htdocs-files
Created June 2, 2017 23:02
Filter out valid htdocs files to expose (old and backup) files with odd names
#!/bin/bash
# filter-htdocs-files
# Filter out valid htdocs files to expose (old and backup) files with odd names
#
# Output files:
# ~/htdocs.files: List of all files found in this script
# ~/htdocs.urls: List of all URLs where the found files can be accessed
#
# This file can also be passed to wget to check automagically the urls like so: