Skip to content

Instantly share code, notes, and snippets.

@pstoll
pstoll / gs-tiller-group-cat-report-macros.js
Last active May 1, 2022 20:03
GoogleSheet Group Category Reports Macros
/** @OnlyCurrentDoc */
/** If you use Tiller & Category Rollup reports, this macro will create the groups to hide/collapse each level of report
* code from https://stackoverflow.com/questions/67784454/group-and-collapse-rows-in-google-apps-script
* relevant docs:
* https://community.tillerhq.com/t/docs-category-rollup-report/121
* https://spreadsheet.dev/reading-from-writing-to-range-in-google-sheets-using-apps-script
*
*/
@pstoll
pstoll / CMakeLists.txt
Created February 3, 2019 17:49
hex sum 1.0.4 source setup.
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
find_package(primesieve "7.0" REQUIRED )
#if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
# set(CMAKE_C_COMPILER "emcc")
# set(CMAKE_CXX_COMPILER "emcc")
#endif ()
@pstoll
pstoll / CMakeLists.txt
Last active November 17, 2023 23:42
Some prime number research, providing the ability to select precision and see the tradeoffs on speed. Do everything to make the computation fast. Yes, I feel dirty about the sighandler stuff.
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
find_package(primesieve "7.0" REQUIRED )
#if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
# set(CMAKE_C_COMPILER "emcc")
# set(CMAKE_CXX_COMPILER "emcc")
#endif ()
$ python ./test-seqs.py
timing 5 iterations with 1000 items:
first 5 ids: ['5aalphabetR84', '2aalphabet3aY', 'BmalphabetACg', 'JMalphabetunQ', 'Gqalphabet7le']
func dedup_orig: 0.00107002258301
func dedup_a1: 0.000247001647949
func dedup_a2: 0.000427961349487
timing 5 iterations with 10000 items:
first 5 ids: ['UPalphabetGuF', 'gqalphabet1rI', 'DGalphabetxbx', 'cHalphabetOYB', 'JYalphabetzW2']
func dedup_orig: 0.0133740901947
func dedup_a1: 0.00292015075684
# /usr/bin/env python
# Author: Perry A. Stoll <perry at pstoll dot com>
# Date: June 2017
# Copyright Perry Stoll
#
# Generate the first N fibonnaci numbers.
#
# Note this is quite different from generating the Nth fibonnaci
# numbers in terms of storage and laying out the computation
#include <assert.h>
#include <inttypes.h>
#include <iostream>
#include <iterator>
#include <vector>
#include <chrono>
$ openssl s_client -showcerts -connect verizon.com:443
CONNECTED(00000003)
depth=1 /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=Santa Monica/O=EdgeCast Networks, Inc./CN=*.can.transactcdn.com
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
-----BEGIN CERTIFICATE-----
{
"battery": {
"temp_stats": {
"max": 29.469999313354492,
"90th": 28.979999542236328,
"10th": 26.260000228881836,
"50th": 27.1299991607666,
"min": 25.84000015258789
},
"cells": {
@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