The bar is in the globe.
This is a factory, not a circus.
I weigh less than a slice of bread.
'Emulate max() as fully as possible in pure Python.' | |
# https://stackoverflow.com/questions/69997857/implementation-of-max-function-in-python/69997876#69997876 | |
# https://github.com/python/mypy/issues/7231 | |
from typing import TypeVar, Any, Iterator, Iterable, Optional | |
from typing import Union, Protocol, Callable, cast, Tuple, overload | |
class SupportsGT(Protocol): |
#include <string.h> | |
#include <unistd.h> | |
char *moomin[] = { | |
" . ,", | |
"ASCII art (c) Maija Haavisto (@DiamonDie)", | |
"", | |
" \"._.' `' mh/VK", | |
" `. `, `. .'", | |
" . .' `. `' ;", |
#!/usr/bin/env python3 | |
import math | |
# >> Discrete Fourier transform for sampled signals | |
# x [in]: sampled signals, a list of magnitudes (real numbers) | |
# yr [out]: real parts of the sinusoids | |
# yi [out]: imaginary parts of the sinusoids | |
def dft(x): | |
N, yr, yi = len(x), [], [] |
By default, sudo
on the Linux systems executes commands into a minimal environment. So, if you for example has some non-standard directories (such as /opt/groovy/bin
)
added to your PATH
, a command running via sudo
won't see any executable in these directories.
Normally, this strict sudo
behavior can be changed by removing env_reset
(or changing env_keep
) variables in /etc/sudoers
.
But what can you do in case when you have only restricted sudo
without write access to this file?
The following command passes a current value of PATH
under a command run with sudo
privileges:
sudo bash -c "export $PATH; which groovy"
def linear_complexity(self, bin_data, block_size=500): | |
""" | |
Note that this description is taken from the NIST documentation [1] | |
[1] http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf | |
The focus of this test is the length of a linear feedback shift register (LFSR). The purpose of this test is to | |
determine whether or not the sequence is complex enough to be considered random. Random sequences are | |
characterized by longer LFSRs. An LFSR that is too short implies non-randomness. | |
:param bin_data: a binary string |
#!/usr/bin/env python3 | |
def flatten(t): | |
""" | |
Generator flattening the structure | |
>>> list(flatten([2, [2, "test", (4, 5, [7], [2, [6, 2, 6, [6], 4]], 6)]])) | |
[2, 2, "test", 4, 5, 7, 2, 6, 2, 6, 6, 4, 6] | |
""" | |
from collections.abc import Iterable |
Info: | See <http://docutils.sf.net/rst.html> for introductory docs. |
---|---|
Author: | David Goodger <[email protected]> |
Date: | 2013-02-20 |
Revision: | 7612 |
Description: | This is a "docinfo block", or bibliographic field list |
Note
If you are reading this as HTML, please read