This file contains hidden or 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
$ | |
M_{ij}=\sum\limits_{x}\sum\limits_{y}x^iy^iI(x,y)\\ | |
\eta_{pq}=\sum\limits_{x}\sum\limits_{y}(x-\bar x)^p(y- \bar y)^qI(x,y)\\ | |
\bar x=\frac{M_{10}}{M_{00}}, \bar y=\frac{M_{01}}{M_{00}}\\ | |
\mu_{pq}=\frac{\eta_{pq}}{\eta_{00}^\gamma},\gamma=\frac{p+q}{2}\\ | |
H_{1} = \mu_{20} + \mu_{02}\\ | |
H_{2} = (\mu_{20} - \mu_{02})^2 + 4(\mu_{11})^2\\ | |
H_{3} = (\mu_{30} - 3\mu_{12})^2 + (\mu_{03} - 3\mu_{21})^2\\ | |
H_{4} = (\mu_{30} + \mu_{12})^2 + (\mu_{03} + \mu_{21})^2\\ | |
H_{5} = (\mu_{30} - 3\mu_{12})(\mu_{30} + \mu_{12})((\mu_{30} + \mu_{12})^2 - 3(\mu_{21} + \mu_{03})^2) + (3\mu_{21} - \mu_{03})(\mu_{21} + \mu_{03})(3(\mu_{30} + \mu_{12})^2 - (\mu_{03} + \mu_{21})^2)\\ |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import argparse | |
import os | |
from tempfile import mkdtemp | |
parser=argparse.ArgumentParser() | |
parser.add_argument("input",type=str) | |
args=parser.parse_args() | |
pwd=os.path.realpath(os.getcwd()) |
This file contains hidden or 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
import os | |
def bash_real_time(command): | |
pid,fd = os.forkpty() | |
if pid == 0: | |
os.execv('/bin/bash',['bash','-c',command]) | |
exit(0) | |
while True: | |
try: | |
output = os.read(fd,1024).decode("utf-8").rstrip() |
This file contains hidden or 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 random import shuffle,choice | |
from itertools import repeat,chain | |
from functools import partial | |
from multiprocessing.pool import Pool | |
from argparse import ArgumentParser | |
def cheat(l,x):return True | |
def findIt1(l,x): | |
for i in range(50): | |
if l[i]==x:return True | |
return False |
This file contains hidden or 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
#include<stdio.h> | |
#include <time.h> | |
struct timespec TIMER_START,TIMER_END; | |
long unsigned int timer(int f){ | |
if(f){ | |
clock_gettime(CLOCK_MONOTONIC_RAW, &TIMER_START); | |
return 0; | |
} | |
clock_gettime(CLOCK_MONOTONIC_RAW, &TIMER_END); | |
return (TIMER_END.tv_sec - TIMER_START.tv_sec) * 1e9 + (TIMER_END.tv_nsec - TIMER_START.tv_nsec); |
This file contains hidden or 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <pty.h> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
int ptytest(){ | |
int master; | |
pid_t pid; | |
pid = forkpty(&master, NULL, NULL, NULL); |
NewerOlder