Skip to content

Instantly share code, notes, and snippets.

View LuisCardenasSolis's full-sized avatar

Luis Cardenas LuisCardenasSolis

View GitHub Profile
set tabstop=2
set shiftwidth=2
set expandtab
augroup openintab
autocmd!
autocmd BufAdd,BufNewFile * nested tab sball
augroup end
cnoreabbrev tn tabnext
cnoreabbrev tp tabprevious
cnoreabbrev add arga
@LuisCardenasSolis
LuisCardenasSolis / cbpolicyd
Last active August 24, 2021 19:06
Install and configura Cbpolicyd in Zimbra
INSTALL (https://imanudin.net/2014/09/08/how-to-install-policyd-on-zimbra-8-5/)
su - zimbra
zmprov ms `zmhostname` +zimbraServiceInstalled cbpolicyd +zimbraServiceEnabled cbpolicyd
#Verify apache Zimbra
---
rpm qa | grep zimbra-apache-components
yum install zimbra-apache-components
cd package && rpm -Uvh zimbra-apache-**
@LuisCardenasSolis
LuisCardenasSolis / buildES5.md
Last active May 20, 2021 05:56
Compile es6 to es5 by command line / Ofuscar codigo - compilado bash script

Install nodejs (npm,npx)

curl -sL https://rpm.nodesource.com/setup_12.x | bash - yum install nodejs -y

Install babel

npm install -g @babel/core @babel/cli @babel/preset-env

Validate

npm list -g --depth=0

@LuisCardenasSolis
LuisCardenasSolis / CreateZimlets.md
Last active June 4, 2020 05:37
Create and deployment custom zimlets - Zimbra

Create zimlet zip

First verify that the js code is compiled to es5 [You can use buildES5 script]

/opt/zimbra/bin/zmzimletctl createZip zimlet_prod

Deploy zimlet zip

Enable zimlet in COS

/opt/zimbra/bin/zmzimletctl deploy zimlet_prod.zip
@LuisCardenasSolis
LuisCardenasSolis / purgeAccountZimbra.sh
Last active May 26, 2021 22:11
Limpiar Buzones y eliminar contactos no deseados
#!/bin/bash
USERS=$( /opt/zimbra/bin/zmprov -l gaa | grep -Ev 'spam\.|ham\.|virus-quarantine\.|galsync')
for account in $USERS
do
echo -n "Purging ${account} : "
/opt/zimbra/bin/zmmailbox -z -m ${account} emptyFolder /Trash
/opt/zimbra/bin/zmmailbox -z -m ${account} emptyFolder /Drafts
/opt/zimbra/bin/zmmailbox -z -m ${account} emptyFolder /Junk
echo "...done"
@LuisCardenasSolis
LuisCardenasSolis / spam_peru.cf
Last active November 12, 2020 17:03
Spam Peru
#
# Este archivo es donde se ponen las reglas para detectar spam via MCP
# (Message Content Protection)
#
# Reglas para SPAMMERS peruanos
#
# Ponerlo en /etc/mail/spamassassin
#
# Autor: Alex Celi - alex arroba linux punto org punto pe
# http://cipher.pe
@LuisCardenasSolis
LuisCardenasSolis / date-formate.js
Last active January 13, 2024 20:47
Manejo de fechas con vanilla JS
//Fecha actual
const date = new Date()
//Fecha menos X dias - ejm 1
const day_past = new Date(new Date().getTime() - 1*86400000)
//Formato de fechas:
const day = '0'.concat(date.getDate()).slice(-2) // dd
const month = '0'.concat(date.getMonth() + 1).slice(-2) // mm
const year = date.getFullYear() // yyyy
@LuisCardenasSolis
LuisCardenasSolis / get_report.sh
Created March 4, 2021 05:26
Reporte de mensajes enviados y recibidos - Zimbra
#!/bin/bash
if [ -z $1 ]; then
echo "ERROR: Proporcionar el usuario para le reporte"
exit 1
fi
sender(){
echo "Sender :"
/opt/zimbra/libexec/zmmsgtrace -s "^${1}$" /opt/backup/logs/zimbra.log-202* > /tmp/${1} 2> /dev/null
const validateEmail = email => {
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(String(email.trim()).toLowerCase())
}
const deleteRepeated = (valor, indice, self) => {
return self.indexOf(valor.toString()) === indice
}
//arrray: data.filter(validateEmail).filter(deleteRepeated)
@LuisCardenasSolis
LuisCardenasSolis / antispam.cf
Last active July 7, 2023 23:16
Custom rule for spamassassin
#WHITELIST
whitelist_from *@perulinux.pe
whitelist_from *@bcp.com.pe
whitelist_from *@scotiabank.com.pe
whitelist_from *@verisure.pe
whitelist_from *@telefonica.com
whitelist_from *@munlima.gob.pe
whitelist_from *@alignet.com
whitelist_from *@pay-me.com
whitelist_from *@perutributario.com.pe