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
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 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 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
/* source: http://aa.quae.nl/en/reken/zonpositie.html */ | |
// source: http://en.wikipedia.org/wiki/Julian_day | |
int julian_jdn(int year, int month, int day) { // convert Gregorian calendar date to Julian Day Number | |
int a = (14 - month) / 12; | |
int y = year + 4800 - a; | |
int m = month + 12 * a - 3; | |
return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045; | |
} |
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
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 |
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
// Coding Challenge 130.3: Drawing with Fourier Transform and Epicycles | |
// Daniel Shiffman | |
// https://thecodingtrain.com/CodingChallenges/130.1-fourier-transform-drawing.html | |
// https://thecodingtrain.com/CodingChallenges/130.2-fourier-transform-drawing.html | |
// https://thecodingtrain.com/CodingChallenges/130.3-fourier-transform-drawing.html | |
// https://youtu.be/7_vKzcgpfvU | |
// https://editor.p5js.org/codingtrain/sketches/ldBlISrsQ | |
class Complex { | |
constructor(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
//NAND logic gate (and others) with only exponentiation. | |
/* | |
Exponentiation: 13 | |
0^0 1 | |
0^1 0 | |
1^0 1 | |
1^1 1 | |
NAND: 7 |
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 BigO(arr, arr3) { // Second array is optional | |
this.accumulator = 0; // Can be set here, or when calling ClosestMatch | |
/* function factorial(n, i) { | |
if (n > 171) // Overflow prevention | |
return Infinity; | |
if (typeof i == 'undefined') | |
i = 1; | |
if (n < i) | |
return 1; | |
if (n === i) |
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
// Inspired by: | |
// https://interviewing.io/recordings/Go-Microsoft-1 | |
function NthClosest(points, match, n) { | |
if (n < 1 || n > points.length || points[0].length != match.length) | |
return false; | |
function distance(p1, p2) { // Works in any dimensions. | |
let out = 0, d = 0, len = p1.length; | |
for (let i3 = 0; i3 < len; i3++) { |
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 bubbleSort(arr, cmp) { | |
var len = arr.length, tmp, n; | |
if (typeof cmp !== 'function') | |
cmp = function(a, b) { | |
return a > b; | |
}; | |
do { | |
n = 0; | |
for (var i = 1; i < len; i++) { | |
if (cmp(arr[i], arr[i-1])) continue; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>Google Drive Demo</title> | |
</head> | |
<body> | |
<div style="position: absolute; top: 40%; left: 50%; transform: translate(-50%, -40%); text-align: center;"> | |
<a href="https://drive.google.com/open?id=1v1-ApluL9dCGx4znKVSXGKnBf4dFVGuv">Letöltés</a><br><br> |