Skip to content

Instantly share code, notes, and snippets.

diff --git a/setup.py b/setup.py
index b8b003b..e8bf426 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,16 @@
from setuptools import setup, Extension
from glob import glob
+import os
+
+os.environ["CC"] = "/usr/local/bin/clang-omp -fopenmp"
@pstoll
pstoll / gist:4107025
Last active October 12, 2015 23:57
golang tour 45
package main
// http://tour.golang.org/#46
// question - is this efficient?
// ie is range operator returning refs or copies of the string elements?
import (
"tour/wc"
"strings"
)
@pstoll
pstoll / gist:4107103
Created November 18, 2012 19:45
Golang tour 48 fibanacci using a closure
// http://tour.golang.org/#48
//
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
prev := 0;
@pstoll
pstoll / golang-tour-47.go
Created November 18, 2012 21:43
Cube root example in GoLang tour #47
package main
import "fmt"
import "math/cmplx"
func Cbrt(x complex128) complex128 {
z:=complex128(1.0)
min_delta := float64(0.00000000001)
delta := complex128(1.0)
var iter int
@pstoll
pstoll / results.txt
Created November 15, 2015 19:19
Test timing of writing arrays in place vs using vectors for numpy primesieve bindings
pstoll$ python test.py
test1 arrays: 6.956779105006717
test1a arrays: 6.8869501760054845
test2 native vectors: 59.97818154899869
test2a native vectors: 90.65342697499727
python test.py
test1arr for 100000000 primes: write directly to array with new generate_n_primes_array 2.82 sec
test1iter for 100000000 primes: write to numpy data using iter interface: 3.65 sec
test1iter2 for 100000000 primes: write to numpy data using iter interface data access: 3.40 sec
test1np for 100000000 primes: use normal vector generation but copy directly to numpy on output: 4.16 sec
test2 for 100000000 primes: current vector generate_n_primes with numpy copy from vector to output list: 21.03 sec
test2a for 100000000 primes: current vector, copy to output list, create numpy array: 36.25 sec
@pstoll
pstoll / run.txt
Last active November 26, 2015 01:22
Sample showing the power of slices and letting callers specify the output array for NumPy like ufuncs
primesieve-python pstoll$ python testnumpy.py
straight into array: [ 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71]
offset by 10: [ 0 0 0 0 0 0 0 0 0 0 2 3 5 7 11 13 17 19 23 29]
strided by 2: [ 2 0 3 0 5 0 7 0 11 0 13 0 17 0 19 0 23 0 29 0]
@pstoll
pstoll / gist:3e0b56e95558f568e38f
Last active November 26, 2015 01:23
latest prime-hexagon prime generation with new/better primesieve-python interface
# 10B values using new prime generation interface directly to numpy arrays
# total time - 1m:43sec for the entire calculation.
# prime generation was only 10 sec.
# it all fit in RAM for my 16GB machine.
prime-hexagon pstoll$ python ./primespin.py --nvalues=$(echo 10,000,000,000|tr -d ,) --chunks 10 --skip 1000000
2015-11-18 02:08:34,722 - prime_hex - INFO - starting generating primes from 1 to 10000000000
trying direct numpy prime generation...
2015-11-18 02:08:44,534 - prime_hex - INFO - done generating primes
2015-11-18 02:08:44,534 - prime_hex - INFO - compute_spins: generating mod6Values
2015-11-18 02:09:04,147 - prime_hex - INFO - compute_spins: done mod6Values
@pstoll
pstoll / remsh.erl
Created July 25, 2013 17:11 — forked from davisp/remsh.erl
#! /usr/bin/env escript
%%! -hidden -noshell -noinput
-mode(compile).
-export([
init_shell_log/1
]).
--- src/http/ngx_http_variables.c.orig 2010-01-11 03:21:46.000000000 -0800
+++ src/http/ngx_http_variables.c 2010-02-18 10:01:32.000000000 -0800
@@ -93,6 +93,9 @@
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+
/*