Skip to content

Instantly share code, notes, and snippets.

View aolle's full-sized avatar

Àngel Ollé Blázquez aolle

View GitHub Profile
@aolle
aolle / run_nagios.sh
Created August 17, 2016 13:30
Docker run script for nagios4
#!/bin/bash
docker run --name srv01-nagios4 \
-v /etc/localtime:/etc/localtime:ro \
-v ~/docker/nagios/custom:/opt/nagios/Custom-Nagios-Plugins \
-v ~/docker/nagios/etc:/opt/nagios/etc/ \
-v ~/docker/nagios/var:/opt/nagios/var \
--net=backend \
--net-alias nagios4 \
--add-host srv02:xx.xx.xx.xx \
@aolle
aolle / run_mariadb.sh
Created August 17, 2016 13:29
Docker run script for mariadb
#!/bin/bash
docker run --name srv01-mariadb \
-v ~/docker/mariadb/logs:/var/log/mysql \
-v ~/docker/mariadb/conf.d/:/etc/mysql/conf.d \
-v ~/docker/mariadb/mysql/:/var/lib/mysql \
-v /etc/localtime:/etc/localtime:ro \
-e MYSQL_ROOT_PASSWORD=password \
-u mysql:mysql \
--cap-drop=all \
@aolle
aolle / run_httpd.sh
Created August 17, 2016 13:25
Docker run script for httpd+php5
#!/bin/bash
IP=xx.xx.xx.xx
docker run --name srv01-httpd \
-v ~/docker/httpd-php/config/apache2/:/etc/apache2/ \
-v ~/docker/httpd-php/config/php/:/usr/local/etc/php/ \
-v ~/docker/httpd-php/src/:/var/www/html/ \
-v ~/docker/httpd-php/logs/:/logs/ \
-v /etc/localtime:/etc/localtime:ro \
@aolle
aolle / Dockerfile-httpd-php5
Created August 17, 2016 13:21
Custom Dokerfile httpd+php5
FROM php:5-apache
RUN apt-get update
RUN apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libapache2-mod-security2 \
&& docker-php-ext-install -j$(nproc) iconv mcrypt pdo_mysql mysqli mysql pdo \
@aolle
aolle / sed.md
Created August 17, 2016 13:13
sed cheatsheet

Extreure línies entre dues dates

Molts cops es necessiten extreure les línies entre dues dates concretes de fitxers de log. Per fer-ho, podem utilitzar sed, de manera:

sed -n '/start/,/end/p' log.txt

Per exemple, a un fitxer de log on el format de la data és tipus: * [03/Dec/2015:10:32:20 -0500]*, farem:

@aolle
aolle / LXC.md
Last active April 10, 2018 07:05
LXC notes

Instal·lar LXC

$ sudo apt install lxc bridge-utils libvirt-bin debootstrap

Crear contenidor LXC

@aolle
aolle / compression.md
Last active February 22, 2023 01:57
7z/tar/zip/gzip cheatsheet

7z

Compresión máxima

$ 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1

Copy mode (sin compresión)

@aolle
aolle / ssh-pivoting.md
Last active April 10, 2018 06:31
SSH pivoting

SSH pivoting

Scenario:

Origin => MachineA => FW => MachineB

We've access to MachineA through SSH and MachineA has access to MachineB through FW. We want to reach the remote port 5000 of MachineB; We'll map our localhost 5000 port to remote 5000 port of MachineB through the MachineA.

The SSH command will be:

main() {
int *a;
*a += 1;
}
@aolle
aolle / mod_prv.c
Created August 17, 2016 09:56
Apache custom module for privilege escalation
/*
** mod_prv.c -- Apache sample prv module
** [Autogenerated via ``apxs -n prv -g'']
**
** To play with this sample module first compile it into a
** DSO file and install it into Apache's modules directory
** by running:
**
** $ apxs -c -i mod_prv.c
**