Skip to content

Instantly share code, notes, and snippets.

View iashris's full-sized avatar
🎯
Focusing

Ashris iashris

🎯
Focusing
View GitHub Profile
import collections
import math
import os
import cv2
import numpy as np
import time
MAX_LINES = 4000
N_PINS = 36*8
MIN_LOOP = 20 # To avoid getting stuck in a loop
@iashris
iashris / index.html
Created November 24, 2016 20:43
This is the template of html file to use for p5js projects for me
<!DOCTYPE html>
<html>
<head>
<title>p5js fullscreen template</title>
</head>
<style type="text/css">
canvas {
position: fixed;
top: 0; left: 0;
z-index: 1;
@asciimike
asciimike / firebase_storage_multi_file_upload.js
Last active November 29, 2021 18:05
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) {
@mineta
mineta / marinamele_sieve_atkin.py
Last active September 9, 2023 12:54
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)):