Skip to content

Instantly share code, notes, and snippets.

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

Andres Hernandez tonejito

🐰
= ^ . ^ =
View GitHub Profile
@tonejito
tonejito / check-host
Last active February 2, 2017 19:14
Check host via HTTP using HEAD method with @curl
#!/bin/bash
HOST=${1}
curl -vk#1A '' -X HEAD -H 'Connection: close' "http://${HOST}/"
@tonejito
tonejito / no-asset-log.conf
Last active January 31, 2017 19:55
Disable asset logging on @apache httpd via mod_setenvif
# Available loglevels:
# trace8, ..., trace1, debug, info, notice, warn, error, crit, alert, emerg.
# http://httpd.apache.org/docs/2.4/mod/core.html#loglevel
LogLevel info
# http://httpd.apache.org/docs/2.4/mod/core.html#errorlog
ErrorLog ${APACHE_LOG_DIR}/error.log
# http://httpd.apache.org/docs/2.4/mod/mod_log_config.html#customlog
<IfModule log_config_module>
# Set normal logging if mod_setenvif is not loaded
@tonejito
tonejito / which-debian.log
Last active July 28, 2017 23:02
Which @Debian version does this server use?
# cat /etc/debian_version
stretch/sid
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.7 (jessie)
Release: 8.7
Codename: jessie
@tonejito
tonejito / Makefile
Last active November 23, 2016 22:13
Protect PDF files with random password
SHELL=/bin/bash
# http://www.imagemagick.org/script/convert.php
# https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
# https://github.com/gutschke/pdf2odt
# https://helpx.adobe.com/acrobat/using/scan-documents-pdf.html#Searchable%20Image
FILE=file
PREFIX=scratch
@tonejito
tonejito / sudoers-insults
Last active February 1, 2025 00:36
sudoers.d insults configuration file
# = ^ . ^ =
#
# /etc/sudoers.d/sudoers-insults
# sudoers.d insults configuration file
# Andres Hernandez - tonejito
#
# This file must be mode 0440 and owner root:root
# install --mode 0440 --owner root --group root sudoers-insults /etc/sudoers.d/
#
# Edit with visudo
@tonejito
tonejito / check-ip
Last active December 5, 2016 19:17
Check IP address
#!/bin/bash
# = ^ . ^ =
#URL="http://checkip.dyndns.org:8245/"
#URL="http://checkip.dyndns.org/"
URL="http://checkip.dns.he.net/"
if [ -x "`which links`" ]
then
links -dump $URL
@tonejito
tonejito / sort-body
Created November 10, 2016 20:29
Print header line and sort the rest of the file
#!/bin/bash
# http://unix.stackexchange.com/a/11857
$@ | (read -r ; printf "%s\n" "$REPLY" ; sort)
@tonejito
tonejito / = ^ . ^ =
Created October 10, 2016 05:38
= ^ . ^ =
#!/bin/echo '= ^ . ^ ='
#!/bin/bash
PREFIX=user
for NUMBER in {00..09}
do
NAME="${PREFIX}${NUMBER}"
# Genera la sal aleatoriamente desde /dev/urandom
SALT=$(dd if=/dev/urandom bs=1 count=6 2>/dev/null | base64)
PW="`mkpasswd -m sha-256 'password'${NUMBER} ${SALT}`"
@tonejito
tonejito / install-moodle.sh
Last active September 26, 2016 06:33
Install Moodle 3.0 on Ubuntu Server 16.04
#!/bin/bash
MYSQL_PW=""
MOODLE_PW=""
# Install software
aptitude update
aptitude --assume-yes safe-upgrade
aptitude --assume-yes install tasksel git curl