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
# Based on: https://stackoverflow.com/questions/43665208/how-to-get-the-latest-frame-from-capture-device-camera-in-opencv/54755738#54755738 | |
# | |
# Added: | |
# - configurable delay handling | |
# - renamed class | |
# - per frame timestamp output | |
# | |
import cv2, threading, time, queue | |
from sys import argv |
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 subprocess import Popen, PIPE | |
from sys import argv | |
import re | |
stop = "qwertz1234567890ufugUUGUGUgUgUGuGFzR775§%!=%%54321rUF/Rtt8t8TTT4§2hj\n" | |
bye = ["tschüs","do_widzenia","ahoj","ciao","salut","adieu","vaarwel","farvel"] | |
byes = re.sub(r"['[]]*", "", str(bye)) | |
cmd = "bash" if len(argv) == 1 else argv[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
from subprocess import Popen, PIPE | |
from sys import argv | |
cmd = "bash" if len(argv) == 1 else argv[1] | |
p = Popen(cmd, stdin=PIPE, stdout=PIPE) | |
while True: | |
p.stdin.write(bytes(input(cmd + ": ") + "\n", 'utf-8')); p.stdin.flush() |
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
https://github.com/Hermann-SW/RSA_numbers_factored/ | |
# RSA_numbers_factored.py | |
# | |
# v1.9 | |
# remove not needed anymore RSA().__init__() | |
# add RSA().square_sums() | |
# manual transpilation to RSA_numbers_factored.js | |
# new home in RSA_numbers_factored repo python directory | |
# gist now is pointer to new home only |
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
\documentclass{article} | |
\usepackage{mathtools} | |
\begin{document} | |
\begin{eqnarray*} | |
(2^n)! \cdot 2 & =& 2^{2^n} \cdot \prod_{j=1}^{n-1} \enspace \prod_{i=2^{n-j-1}+1}^{2^{n-j}}(2i-1)^{j} \\ | |
\end{eqnarray*} | |
\end{document} |
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
define fac(n) { | |
if (n==0) return 1; | |
return n*fac(n-1) | |
} | |
define facmod(n, m) { | |
if (n==0) return 1; | |
return n*fac(n-1)%m | |
} |
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
define gcd_(a, b) { | |
if (b==0) return a | |
return gcd_(b, a%b) | |
} | |
define gcd(a, b) { | |
if (a<b) return gcd_(b, a) | |
return gcd_(a, b) | |
} |
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
pi=4*a(1) | |
d=pi/180 | |
define sin(x){return s(x)} | |
define cos(x){return c(x)} | |
define atan(x){return a(x)} | |
define tan(x) { | |
if (c(x)==0) return pi/2 | |
return s(x)/c(x) |
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
define powm_(a, e, n) { | |
if (e==1) return a%n | |
p = powm_(a, e/2, n) | |
if (e%2==0) { return p*p%n } else { return a*p*p%n } | |
} | |
define powm(a, e, n) { | |
if (e==0) return 1 | |
return powm_(a, e, n) | |
} |
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
function nth(P) { | |
var n=P.length; var S = []; var fac=[1]; | |
for(i=1; i<=n; ++i) { S.push(i); fac.push(i*fac[i-1]); } | |
var p=0; | |
for(i=0; i<P.length-1; ++i) { | |
var j = S.indexOf(P[i]); | |
p += j*fac[n-1-i]; | |
S.splice(j, 1); | |
} | |
return p; |