Skip to content

Instantly share code, notes, and snippets.

View iashris's full-sized avatar
🎯
Focusing

Ashris iashris

🎯
Focusing
View GitHub Profile
@iashris
iashris / marinamele_sieve_atkin.py
Created June 19, 2019 08:04 — forked from mineta/marinamele_sieve_atkin.py
Python code. Sieve of Atkin algorithm to find prime numbers
import math
def atkin(nmax):
"""
Returns a list of prime numbers below the number "nmax"
"""
is_prime = dict([(i, False) for i in range(5, nmax+1)])
for x in range(1, int(math.sqrt(nmax))+1):
for y in range(1, int(math.sqrt(nmax))+1):
n = 4*x**2 + y**2
if (n <= nmax) and ((n % 12 == 1) or (n % 12 == 5)):
@iashris
iashris / firebase_storage_multi_file_upload.js
Created February 18, 2018 21:16 — forked from asciimike/firebase_storage_multi_file_upload.js
Upload multiple files transactionally in Firebase Storage
// set it up
firebase.storage().ref().constructor.prototype.putFiles = function(files) {
var ref = this;
return Promise.all(files.map(function(file) {
return ref.child(file.name).put(file);
}));
}
// use it!
firebase.storage().ref().putFiles(files).then(function(metadatas) {