Skip to content

Instantly share code, notes, and snippets.

View milosdjakonovic's full-sized avatar

Miloš Đakonović milosdjakonovic

  • Belgrade, Republic of Serbia
View GitHub Profile
@milosdjakonovic
milosdjakonovic / postfix.md
Last active March 18, 2019 13:28
Strip some sensitive info from Postfix-sent emails

Received: from [192.168 Received: from localhost

nano /etc/postfix/header_checks

/^Received: from \[192\.168\..*$/   IGNORE
/^Received: from localhost .*$/     IGNORE
/^Received: from.*127\.0\.0\.1.*$/  IGNORE

#Installing configuring Postfix/Dovecot/Spamassassin/Roundcube

I've documented the steps in short to help me reproduce all the steps. Published it here for improvement and as a reference for others. Of course feel free to comment to improve this document.

This Gist is quite big and not all details are fully explained. But if you're going to run a mailserver you should be able to fill in the missing parts. The most important are covered. But be sure to read up to understand the meaning of all the stuff you configure. Since I used a lot of references of other sources (See at the end) I left out a lot of explanation in this document.

Don't forget that I'm not a Postfix/Dovecot/Spamassasin pro either. I just got it working the way I wanted to.

  • Used Ubuntu 12.04 LTS.
  • Set a root password.
@milosdjakonovic
milosdjakonovic / readme.md
Created March 19, 2017 13:46
Clamsmtp reject zipped dangerous files (exe, com...) in attachments
@milosdjakonovic
milosdjakonovic / index.js
Created November 21, 2016 14:07
Requirejs with localstorage caching
(function(w,d){
var DATA_MAIN='assets/js/login';
sc = d.createElement('script'), head = d.getElementsByTagName('head')[0];
sc.setAttribute('data-main', DATA_MAIN );
sc.setAttribute('async', 'true');
if( !'localStorage' in w || !w.localStorage.getItem('requirejs')){
sc.src="assets/js/require.min.js"
} else {
sc.innerHTML=localStorage.getItem('requirejs');
}
@milosdjakonovic
milosdjakonovic / loadCss.js
Last active November 8, 2016 10:49
Dynamic css loader
;(function(w,d){
var head = d.head || d.getElementsByTagName('head')[0],
raf = w.requestAnimationFrame ||
w.mozRequestAnimationFrame ||
w.webkitRequestAnimationFrame ||
w.msRequestAnimationFrame ||
function(callback) {
return setTimeout(callback, 16)
@milosdjakonovic
milosdjakonovic / registerResizeFunction.js
Created September 28, 2016 12:24
Register resize function - an easy way to register function for debounced execution with parameters
/**
*
* Usage example:
*
* $('#headerghost').css('height', $('header').outerHeight()-32);
*
* registerResizeFunction(function($header, $headerghost){
* $headerghost.css('height', $header.outerHeight()-32);
* }, $('header'), $('#headerghost'));
*
@milosdjakonovic
milosdjakonovic / SmallestDOMReadyEnhanced.js
Created September 3, 2016 10:56
Smallest DOM Ready ever enhanced
/**
* This is patch to famous Dustin Diaz's
* Smallest DomReady Ever
* http://dustindiaz.com/smallest-domready-ever
*
* It is executing argument function inside
* anonimous function specified in setTimeout
*
* That way, we can use Smallest DomReady Ever in
@milosdjakonovic
milosdjakonovic / pattern.js
Created July 28, 2016 18:50
Regex to match media queries and get values
/@\s*?media\s*?\(\s*?(min|max)-(width|height)\s*?:\s*?(\d+)(px|em)\s*?\)\s*?{(.*)}/gms
/**
* Only basically tested.
* Should match min-max-width-height number px|em and following rules.
* Provides capturing groups to determinate condition alongside with css.
*
* Created with help of regex101
* https://regex101.com/r/zA6fX2/1
@milosdjakonovic
milosdjakonovic / datasrc.js
Created July 15, 2016 12:52
Auto lazy load of data-src images
;(function(w,d){
var fn=function(){
var body = d.body || d.getElementsByTagName('body')[0];
if(d.querySelectorAll)
var allimgs = d.querySelectorAll('img[data-src]'), allimgs_len = allimgs.length;
for(var i=0;i<allimgs_len;i++){
allimgs[i].setAttribute('src', allimgs[i].getAttribute('data-src'));
}
}
@milosdjakonovic
milosdjakonovic / README.md
Created July 15, 2016 12:50 — forked from Spea/README.md
Script to auto reply emails.

General

This script can be used in conjunction with the ISPmail tutorial and the Roundcube autoreply plugin

Installation

Database setup

Create the following table in the database where you created the tables from the ISPmail tutorial.