Skip to content

Instantly share code, notes, and snippets.

View speedlight's full-sized avatar
🎯
Focusing

Carlos E. speedlight

🎯
Focusing
View GitHub Profile

How to use nginx as a reverse-proxy with letsencrypt

Your infrastructure

generated via plantuml

Imgur

Requirements

@speedlight
speedlight / logstash-config-exim
Created August 15, 2017 20:57 — forked from greem/logstash-config-exim
logstash-config-exim
input {
file {
path => "/path/to/exim/mainlog"
start_position => 'beginning'
sincedb_path => "/dev/null"
}
}
filter {
@speedlight
speedlight / Información del Equipo
Created November 12, 2016 18:28
Información general de un sistema GNU/Linux
NOMBRE DEL EQUIPO
NOMBRE_HOST=$(cat /etc/hostname) ; echo $NOMBRE_HOST
FECHA ACTUAL DEL SISTEMA
FECHA_ACTUAL=$(date +"%d %b %y") ; echo $FECHA_ACTUAL
HORA ACTUAL DEL SISTEMA
HORA_ACTUAL=$(date +"%H:%M") ; echo $HORA_ACTUAL
COMPROBAR NOMBRE DE USUARIO CREADO POR UID/GID (EJM. 1000) - VERSION SIMPLE
#!/bin/bash
free_data="$(free)"
mem_data="$(echo "$free_data" | grep 'Mem:')"
free_mem="$(echo "$mem_data" | awk '{print $4}')"
buffers="$(echo "$mem_data" | awk '{print $6}')"
cache="$(echo "$mem_data" | awk '{print $7}')"
total_free=$((free_mem + buffers + cache))
used_swap="$(echo "$free_data" | grep 'Swap:' | awk '{print $3}')"
@speedlight
speedlight / email-sync.sh
Created September 19, 2016 17:28
Email bulk sync with imapsync
#!/bin/bash
# Simple script to sync imap accounts with imapsync
# Author: Carlos Egüez <speedlight>
# Version: 1.0
# The USERLIST file use the user1;pass1;user2;pass2 format, change the IFS=";" variable if needed.
# The USERLIST file is suposed to be in the same location of this script.
imapsyncpath=/path/to/imapsync-folder
# Copied from http://ttaportal.org/wp-content/uploads/2012/10/7-Reallocation-using-LVM.pdf
##
## Showing the problem: need to reallocate 32GB from /dev/mapper/pve-data to /dev/mapper/pve-root
##
df -h
# Filesystem Size Used Avail Use% Mounted on
# /dev/mapper/pve-root 37G 37G 0 100% /
# tmpfs 2.0G 0 2.0G 0% /lib/init/rw
@speedlight
speedlight / Salt install debian and centos5
Last active August 29, 2015 14:17
Salt install for debian and centos5
For Debian just change the name of the branch:
echo "deb http://debian.saltstack.com/debian {wheezy|jessie}-saltstack main" > /etc/apt/sources.list.d/salt.list
wget -q -O- "http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key" | apt-key add -
apt-get update
-----------
For Centos5 the repo is located at copr.fedoraproject.org/coprs/saltstack/salt-el5/ so a one-liner for have a minion installed:
@speedlight
speedlight / gist:7730ab7d27874d92aaba
Last active August 29, 2015 14:16
Pandora agent for Centos
Se crea el archivo del repositorio
vi /etc/yum.repos.d/pandorafms.repo
Con este contenido:
[artica_pandorafms]
name=CentOS6 - PandoraFMS official repo
baseurl=http://artica.es/centos6
gpgcheck=0

Installing git on CentOS 5 using yum

Since you're using CentOS 5, the default package manager is yum, not apt-get. To install a program using it, you'd normally use the following command:

$ sudo yum install <packagename>

However, when trying to install git this way, you'll encounter the following error on CentOS 5:

# This should be changed to your system's jenkins root JENKINS_ROOT="/var/lib/jenkins"
JENKINS_USERS="$JENKINS_ROOT/users"
JENKINS_JOBS="$JENKINS_ROOT/jobs"
JENKINS_CONFIG="$JENKINS_ROOT/config.xml"
# This variable is used so that we can verify that a user is not found
FAIL_TEST=0
exportUserFolder() {
if [ -d "$JENKINS_USERS/$1" ]; then