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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/fontawesome.min.css"> | |
<title>TOTP</title> | |
<style> | |
* { | |
padding: 0; |
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
# Usage: | |
# --- | |
# python combine2len.py [total_len [num_num_spaces ['words.txt' ['banned.txt']]]] | |
from itertools import combinations | |
from pprint import pprint | |
from sys import argv | |
def get_combinations(strings, num_strings, total_length): | |
result = [] |
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
// To compile: | |
// nvcc -O3 -Xcompiler -openmp crc32_quine.cpp -o crc32_quine | |
// Inspired by: https://gist.github.com/praetoriansentry/03b6dc2e68e174ffd8168aef7d85f910 | |
// (Can be timed with: http://www.pc-tools.net/win32/ptime/) | |
// (Was not able to make it faster than the insiration, golang is impressive.) | |
#include <stdio.h> // printf, sprintf | |
#include "Crc32.cpp" // From: https://github.com/stbrumme/crc32 |
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 sys | |
import numpy as np | |
import matplotlib.pyplot as plt | |
## Recursive divisibility histogram | |
# How many times can we divide a number by an integer, and by how many integers? | |
# Divisors start from 2 and increase by 1 until we reach half of the number. | |
# Show 3D histogram. | |
n = int(sys.argv[1]) if len(sys.argv) > 1 and sys.argv[1].isdigit() else 180 |
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
Chicken and egg dilemma solution: | |
--- | |
Description of the dilemma: | |
What came first, the chicken or the [chicken] egg? (Eggs in general certainly existed before chickens did.) | |
Statistical approach: | |
Almost all chickens lay eggs. But most eggs do not hatch to be chickens. (Most are not fertilized, or it is a rooster that hatches.) Thus it is far more likely for an egg to come from a chicken, (thus chicken coming first) than for a chicken to come from an egg. | |
Nomenclaturical approach: | |
The egg that the first chicken came out of was laid by a proto-chicken. Since it could not be known ahead of time, what would emerge from the egg, it is logical to say, that a proto-chicken lays proto-chicken eggs, even if it is a chicken that emerges from it. Here as well the chicken came first (as it emerged from a proto-chicken egg). | |
Meta approach: |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Redundancy checker</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!--<script src="lrs.min.js"></script>--> | |
<style> | |
html { | |
font-family: 'Verdana', sans-serif; |
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 string | |
from sys import argv, stderr | |
from time import time | |
def spinner_f(): | |
while True: | |
for c in '|/-\\': | |
yield c | |
spinner = spinner_f() |
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 sys | |
n = sys.argv[1] if len(sys.argv) > 1 else '12001008-00238600-00100004' | |
n = n.split('-') | |
m = [9, 7, 3, 1] * 2 | |
banks = { | |
'100': 'Magyar Államkincstár', | |
'101': 'Budapest Bank', | |
'103': 'MKB Bank', | |
'104': 'K&H Bank', |
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 sys | |
orig = sys.argv[1] if len(sys.argv) > 1 else 'kocka.html' | |
data = sys.argv[2] if len(sys.argv) > 2 else 'L5_A-17_365000napig_bennmarado_3650napig.txt' | |
start = sys.argv[3] if len(sys.argv) > 3 else '// begin_data' | |
end = sys.argv[4] if len(sys.argv) > 4 else '// end_data' | |
no_backup = True if len(sys.argv) > 5 and sys.argv[5] == 'no_backup' else False | |
clean = True if data == 'clean' else False | |
with open(orig, 'r+', encoding='utf-8') as f: |
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 pyaudio | |
import numpy as np | |
from scipy import signal as sg | |
from scipy.io.wavfile import write | |
p = pyaudio.PyAudio() | |
volume = 1.0 # range [0.0, 1.0] | |
fs = 44100 # sampling rate, Hz, must be integer | |
duration = 1.0 # in seconds, may be float |
NewerOlder