Skip to content

Instantly share code, notes, and snippets.

View andersonberg's full-sized avatar

Anderson Berg andersonberg

View GitHub Profile
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
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
>>> 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])
>>> b.argmax()
2
>>> b.argmin()
0
>>> b = np.array([3.4, 5., 33., 8.])
>>> np.amin(b)
3.4
>>> np.amax(b)
33.0
>>> a.sum()
66
>>> a.sum(axis=0)
array([12, 15, 18, 21])
>>> np.sum(a, axis=0)
array([12, 15, 18, 21])
>>> np.sum(a, axis=1)
array([ 6, 22, 38])
>>> a.transpose()
>>> a.T
array([[ 0, 4, 8],
[ 1, 5, 9],
[ 2, 6, 10],
[ 3, 7, 11]])