This file contains hidden or 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 datetime | |
import time | |
import subprocess | |
import progressbar | |
def pomodoro(interval, break_time=5): | |
subprocess.Popen(['notify-send', '-t', '0', 'Focus on your task!']) | |
for i in range(interval, 0, -1): | |
print i |
This file contains hidden or 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 primes(int kmax): | |
cdef int n, k, i | |
cdef int p[1000] | |
result = [] | |
if kmax > 1000: | |
kmax = 1000 | |
k = 0 | |
n = 2 | |
while k < kmax: | |
i = 0 |
This file contains hidden or 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 = np.array([[0,1,2,3], [4,5,6,7], [8,9,10,11]]) | |
>>> a.flat | |
>>> a.flat[:] | |
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) |
This file contains hidden or 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
>>> b.argmax() | |
2 | |
>>> b.argmin() | |
0 |
This file contains hidden or 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
>>> b = np.array([3.4, 5., 33., 8.]) | |
>>> np.amin(b) | |
3.4 | |
>>> np.amax(b) | |
33.0 |
This file contains hidden or 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.sum() | |
66 | |
>>> a.sum(axis=0) | |
array([12, 15, 18, 21]) |
This file contains hidden or 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
>>> np.sum(a, axis=0) | |
array([12, 15, 18, 21]) | |
>>> np.sum(a, axis=1) | |
array([ 6, 22, 38]) |
This file contains hidden or 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
>>> np.sum(a) | |
66 |
This file contains hidden or 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.transpose() | |
>>> a.T | |
array([[ 0, 4, 8], | |
[ 1, 5, 9], | |
[ 2, 6, 10], | |
[ 3, 7, 11]]) |
This file contains hidden or 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[1,3] | |
9 |
NewerOlder