This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Copyright (C) 2010 Matteo Bertini <matteo@naufraghi.net> | |
# Licensed as http://creativecommons.org/licenses/BSD/ | |
# | |
# This is a naive implementation of the k-means unsupervised clustering | |
# algorithm (http://en.wikipedia.org/wiki/K-means_clustering). | |
from __future__ import division | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A persistent (sqlite3) python dictionary | |
Based on: | |
http://erezsh.wordpress.com/2009/05/31/filedict-bug-fixes-and-updates/ | |
Author: Erez Shinan | |
Date: 31-May-2009 | |
Copyright 2010 Matteo Bertini <matteo@naufraghi.net> | |
Python Software Foundation License (PSFL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import sys | |
import urllib | |
import re | |
import glob | |
import platform | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUBROUTINE FLIKAM(P,MP,Q,MQ,W,E,N,SUMSQ,FACT,VW,VL, | |
* MRP1,VK,MR,TOLER,IFAULT) | |
IMPLICIT DOUBLE PRECISION(A-H,O-Z) | |
C | |
Cf2py intent(in) P | |
Cf2py intent(hide) MP | |
Cf2py intent(in) Q | |
Cf2py intent(hide) MQ | |
Cf2py intent(in) W | |
Cf2py intent(out) E |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* R : A Computer Language for Statistical Data Analysis | |
* Copyright (C) 2002-2006 The R Development Core Team. | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
$ echo "ciao" | python is_regular_file.py - <(cat comments.vim) comments.vim | |
'<stdin>' is not a regular file | |
'/dev/fd/63' is not a regular file | |
'comments.vim' is a regular file | |
""" | |
import os | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from collections import defaultdict | |
def hgignore2skipped(filename): | |
localdir = os.path.dirname(os.path.abspath(os.path.expanduser(filename))) | |
def _iter_skipped(): | |
with open(filename) as lines: | |
for line in (l.strip() for l in lines): | |
if line.startswith("syntax:") or line.startswith("#") or not line: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git-svn-outgoing() { | |
need_stash=$(git st --por | cut -c 1-2 | grep M | cat) | |
if [ "$need_stash" ]; then | |
git stash > /dev/null | |
fi | |
git svn dcommit -n | grep diff-tree | while read line; do git show $(echo $line | cut -d' ' -f 3); done | |
if [ "$need_stash" ]; then | |
git stash pop > /dev/null | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_implementing_classes(method): | |
""" | |
Given a method return all the classes the method is implemented in. | |
a.aaa() -> A.aaa | |
a.bbb() -> A.bbb | |
b.aaa() -> A.aaa | |
b.bbb() -> B.bbb | |
A.aaa == B.aaa -> True | |
A.bbb == B.bbb -> False | |
find_implementing_classes(b.aaa) -> [<class '__main__.A'>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.develer.circularsliderule; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.view.MotionEvent; | |
import android.view.ScaleGestureDetector; | |
import android.view.View; |
OlderNewer