Skip to content

Instantly share code, notes, and snippets.

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

Andres Hernandez tonejito

🐰
= ^ . ^ =
View GitHub Profile
@tonejito
tonejito / get-users
Last active June 2, 2017 18:39
Get normal or system user accounts from `getent passwd` with values from login.defs
#!/bin/bash
# get-users
# Get normal or system user accounts from `getent passwd` with values from login.defs
# Andres Hernandez - tonejito
#
# This script is released under the GPL license version 3
#
# Usage:
# get-users [[--]users | [--]system]
@tonejito
tonejito / gist:cae012347f1b86bc1d67db4bb8abcad4
Last active May 16, 2017 15:21
EMACS: Control Freak VI: Escape Artist
emacs <CTRL><META> + Freak
vim <ESC> :artist
@tonejito
tonejito / apache2.service.conf
Created April 25, 2017 23:19
Set @apache httpd and @php FPM umask on SystemD
# /etc/systemd/system/apache2.service.d/apache2.service.conf
# Service override for Apache on SystemD
# Modify the service umask in order to create group-writable files by default
# After installing this file run `systemctl daemon-reload` and restart the service
# Andres Hernandez (tonejito)
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
# https://serverfault.com/a/582380
@tonejito
tonejito / statusmap.php
Last active April 28, 2017 15:21
Simple status map for @NagiosEnterprises #Nagios 3 written in @php
<?php
# statusmap.php
# Simple status map for Nagios 3 written in PHP
#
# On Debian I normally put this file under /usr/share/nagios3/htdocs/map.php
# and I access it on https://nagios.example.com/nagios3/map.php
# using HTTP authentication
#
# Andres Hernandez - tonejito
# Released under the BSD license
@tonejito
tonejito / mysql-proxy-admin.sh
Last active March 28, 2017 18:56
mysql-proxy : Configuration for @mysql proxy on @Debian 8
#!/bin/bash
# = ^ . ^ =
MYSQL_PROXY_ADMIN=admin
MYSQL_PROXY_PW=mysql
MYSQL_PROXY_SQL=mysql-proxy-admin.sql
mysql --verbose --table -h 127.0.0.1 -P 4401 -u "$MYSQL_PROXY_ADMIN" -p"$MYSQL_PROXY_PW" < $MYSQL_PROXY_SQL
@tonejito
tonejito / restart-httpd.cron
Created March 16, 2017 16:36
Restart @apache httpd every so often
#!/bin/bash
# /etc/cron.daily/99-restart-httpd
#
# Andres Hernandez - @tonejito
#
# Restart @Apache httpd every so often
# I hate these legacy servers…
# If you (are happy and) don't use SystemD, comment out the systemctl sections
#
@tonejito
tonejito / boot-config.md
Last active April 26, 2017 15:22
Debian 8 boot configuration for grub2, rcS and systemd getty / rc.local

Boot configuration for @Debian 8

  • Verbose boot messages for GNU GRUB 2
  • Verbose boot config in /etc/default/rcS
  • Disable VT clear when launching getty via @systemd
  • Enable rc.local facility
@tonejito
tonejito / ncdu.cron
Last active January 9, 2020 16:46
Disk usage report with ncdu
#!/bin/bash
# /etc/cron.daily/ncdu
# Update disk usage report
# Andres Hernandez (tonejito)
# This script is released under the BSD license
# https://dev.yorhel.nl/ncdu
# git://g.blicky.net/ncdu.git/
# autoreconf -i && ./configure --prefix=/usr && make && make install
@tonejito
tonejito / oops-panic.grub.cfg
Last active January 6, 2023 15:04
Linux kernel verbose boot and logging to serial console
# Linux kernel verbose boot and logging to serial console
#
# Check Documentation/kernel-parameters.txt [1] to check all aplicable options for your kernel version
#
# VERSION="v"$(uname -r | sed -e 's/\(\.0\)\?-.*$//')
# [1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/Documentation/kernel-parameters.txt?id=refs/tags/$VERSION
linux /vmlinuz root=/dev/sda1 ro consoleblank=0 earlyprintk=ttyS0 console=ttyS0 panic=1 oops=panic panic_on_warn verbose INIT_VERBOSE=yes init=/sbin/init -v
initrd /initrd.gz
boot
@tonejito
tonejito / httpd-VAST.conf
Last active February 21, 2017 19:19
Tear down all those annoying urlencoded XML-based VAST requests sent to @apache. Tested with @curl
# httpd-VAST.conf
# Tear down all those annoying urlencoded XML-based VAST requests sent to @Apache. Tested with @cURL
# Andres Hernandez (tonejito)
# This might need a ProxyPassMatch regex ! if you use mod_proxy*
# Clear ErrorDocument for this URL
<LocationMatch "^(.*VAST( version=.*(Ad id=.*version=.*([CDATA[.*]])?)?)?.*)$">
ErrorDocument 301 " "
</LocationMatch>