Skip to content

Instantly share code, notes, and snippets.

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 / 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 / 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 /
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 / 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 / gist:2b219d7684b73692c96f
Last active Jan 29, 2016
Drupal HTML article: Delete the teaser image and display the first image (from Drupal Galleria module) in Lightbox (on click).
View gist:2b219d7684b73692c96f
<script type="text/javascript">
try { $('.Image')[0].outerHTML=''; } catch(err) {};
<p><a href="#" onclick="Lightbox.start(
$('#galleria-content ul.galleria li a:eq(0)')[0]);
return false;"><img src="/sites/default/files/posli_to_dal2.jpg" style="float: left;"/></a></p>
martinmev / gist:fdc3462e62b039a910c4
Created Jun 1, 2014
Dump Nokia Suite SQLite database
View gist:fdc3462e62b039a910c4
import sqlite3
conn = sqlite3.connect('c:\\Users\\Martin\\AppData\\Local\\Nokia\\Nokia Data Store\\DataBase\\MDataStore.db3')
for i in conn.iterdump():
martinmev / gist:444619fbdec82864a025
Created Jun 1, 2014
Export contacts from Nokia Suite
View gist:444619fbdec82864a025
import sqlite3
import json
conn = sqlite3.connect('c:\\Users\\Martin\\AppData\\Local\\Nokia\\Nokia Data Store\\DataBase\\MDataStore.db3')
data = {}
cursor = conn.execute("select * from contact")
rows = cursor.fetchall()
getRowData = lambda r : ' '.join([x if x else '' for x in r]).strip()
martinmev / touchtest.html
Last active Aug 29, 2015
Detection (Javascript): Click (Desktop) or Touch (Touch device)?
View touchtest.html
<script src="//"></script>
<script src="//"></script>
<script language="javascript">
mouseOverTime = 0;
martinmev / characterSetMappingTables.jl
Last active Aug 29, 2015
This Julia Gist generates the character set mapping dictionaries from the mappings files (8 bit characters to Unicode; and it decodes the text from a given code page.
View characterSetMappingTables.jl
using HDF5, JLD
@load "c:\\Users\\Martin\\Downloads\\MAPPINGS\\characterSetMappingTables.jld"
function printEncodings()
for mappingTable in sort(collect(keys(characterSetMappingTables)))
You can’t perform that action at this time.