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
/** | |
* The MySensors Arduino library handles the wireless radio link and protocol | |
* between your home built sensors/actuators and HA controller of choice. | |
* The sensors forms a self healing radio network with optional repeaters. Each | |
* repeater and gateway builds a routing tables in EEPROM which keeps track of the | |
* network topology allowing messages to be routed to nodes. | |
* | |
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org> | |
* Copyright (C) 2013-2016 Sensnology AB | |
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors |
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
from itertools import chain | |
def rtrunc_primes(): | |
"""Generate a set of all right-truncatable primes""" | |
rprimes = [[2, 3, 5, 7]] # Seed with 1-digit primes | |
rdigits = [1, 3, 7, 9] # Only possible digits after first digit | |
n = 2 | |
while rprimes[n-2]: # Continue as long as we have found a prime in the previous n | |
nprimes = [p for base in rprimes[n-2] for p in [10*base+d for d in rdigits ] if is_prime (p)] |
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
# Primality testing as taken from http://rosettacode.org/wiki/Miller-Rabin_primality_test#Python | |
# Not proven for very large primes, but probably (?) right? | |
# TODO: try better set from http://miller-rabin.appspot.com/ | |
def _try_composite(a, d, n, s): | |
if pow(a, d, n) == 1: | |
return False | |
for i in range(s): | |
if pow(a, 2**i * d, n) == n-1: | |
return False |
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
# Primality testing as taken from http://rosettacode.org/wiki/Miller-Rabin_primality_test#Python | |
# Not proven for very large primes, but probably (?) right? | |
# TODO: try better set from http://miller-rabin.appspot.com/ | |
from itertools import chain | |
def _try_composite(a, d, n, s): | |
if pow(a, d, n) == 1: | |
return False | |
for i in range(s): | |
if pow(a, 2**i * d, n) == n-1: |
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
diff --git a/_plugins/postfiles.rb b/_plugins/postfiles.rb | |
index 08c60bf..ce79b55 100644 | |
--- a/_plugins/postfiles.rb | |
+++ b/_plugins/postfiles.rb | |
@@ -20,13 +20,13 @@ def generate(site) | |
site.posts.each do |post| | |
# Go back to the single-file post name | |
- postfile_id = post.id.gsub(/[\s\w\/]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4') | |
+ postfile_id = post.id.gsub(/[\s\w\/%]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4') |