Skip to content

Instantly share code, notes, and snippets.

martinmev / gist:8248935
Last active Mar 27, 2016
Configuration: Postfix SMTP authentication and Dovecot SASL
View gist:8248935

Postfix SMTP authentication and Dovecot SASL

  • /etc/postfix/
  smtp      inet  n       -       -       -       -       smtpd
  submission inet n       -       -       -       -       smtpd
    -o smtpd_tls_security_level=encrypt
    -o smtpd_sasl_auth_enable=yes
martinmev /
Last active Jan 1, 2016
Drupal 6: this tiny module disables 'Request new password' functionality
; $Id$
name = Disable Request new password
description = Disable 'Request new password' functionality
core = 6.x
package = "Other"
version = "6.x-0.1"
martinmev / imgfft.m
Created Dec 26, 2013
Convert image to an abstract picture
View imgfft.m
%% run in Octave:
%% source 'imgfft.m'
filename = 'image.jpg';
img = imread(filename);
img3= (img2(:,:,1)+img2(:,:,2)+img2(:,:,3))/3;
martinmev / gist:7741936
Last active Oct 8, 2017
Fix ugly file names (a simple shell function)
View gist:7741936
fix () {
for x in *
mv -- "$x" `echo "$x" | iconv -f utf8 -t ascii//TRANSLIT | tr '[:upper:]' '[:lower:]' | sed 's/[^-.a-zA-Z0-9]\+/-/g' | sed 's/[-]\+/-/g'` 2> /dev/null
fixDirs () {
for x in *
martinmev /
Created Aug 8, 2013
Output for the new submission parser. This submission for 0.95045 uses PCA and svm.SVC classifier. Kaggle competition: Data Science London + Scikit-learn.
#!/usr/bin/env python
import numpy as np
from sklearn import grid_search
from sklearn import cross_validation as cv
from sklearn.svm import SVC
from sklearn.cross_validation import StratifiedKFold
from sklearn.decomposition import PCA
loadData = lambda f: np.genfromtxt(open(f,'r'), delimiter=',')
martinmev / flat.pde
Last active Dec 15, 2015
Simple plan of flat created in Processing
View flat.pde
// Copyright Martin Mevald 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// PDFs and PNGs:
import processing.pdf.*;
martinmev /
Last active Dec 10, 2015
Script gets delivery errors from mbox file.
#!/usr/bin/env python
import sys
def writeErrors(mbox,filename):
isMessage=lambda c: mbox[c].strip()=='The mail system'
getMessage = lambda c,s: s if mbox[c].strip()=='' else s+' '+getMessage(c+1,mbox[c].strip())
while counter<len(mbox):
martinmev /
Created Sep 16, 2012
Script gets email addresses from the text (first argument). Emails are written to the output file (second argument).
#!/usr/bin/env python
import sys
import re
getEmails = re.compile(r'[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4}')
found = set()
for c in content:
martinmev / README.txt
Created Aug 23, 2012
Modified Drupal module Galleria
View README.txt
Modified Drupal module Galleria
The example of the modified galleria:
Galleria 6.x-1.0
martinmev / ftp.class.php
Created Dec 27, 2011
Whole ftp.class.php with SSL
View ftp.class.php
//ftp class
//create:2004-6-23 09:22
//modify: 2011-12-30 - Martin Mevald, - added SSL connection