Skip to content

Instantly share code, notes, and snippets.

View gonaumov's full-sized avatar
💭
a status

George Naumov gonaumov

💭
a status
View GitHub Profile
@gonaumov
gonaumov / the_prince.py
Created February 26, 2024 11:06
A simple script which displays how many years ago was written "The Prince" by Machiavelli.
from datetime import datetime
def years_until_now(input_year):
return int(datetime.now().strftime('%Y')) - input_year
the_prince_written_year = 1513
print(f'"The prince" was written {years_until_now(the_prince_written_year)} ago.')
@gonaumov
gonaumov / random_items.py
Created January 12, 2024 16:32
Random item generator
import random
first_group = [1, 2, 3]
second_group = [5, 4, 6]
third_group = [7, 8, 9]
def print_winner(group, group_name):
print(f'The winner from {group_name} is {random.choice(group)}')
actor_name = input()
academy_scores = float(input())
number_of_evaluators = int(input())
needed_scores = 1250.5
for _ in range(number_of_evaluators):
evaluator_name = input()
scores_evaluator_gave = float(input())
received_scores = (len(evaluator_name) * scores_evaluator_gave) / 2
fun main() {
for (i in 1..10) {
// Here we provide the logic
// which must be repeated
}
}
// imagine this is the place where you usually
// get the response in the normal application
// you need just to pass here result variable
// it will create a .txt file with the json
// and download it. You need just to reuse this
// mock file later.
const element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(results, null, ' ')));
element.setAttribute('download', 'data.txt');
package converter
import java.math.BigInteger
class NumberConverter(
private val sourceBase: BigInteger,
private val targetBase: BigInteger
) {
private fun convertFromDecimal(decimalNumber: BigInteger): String {
package converter
import java.math.BigInteger
private const val MAXIMUM_OCTAL_SYSTEM = 10
private const val CAPITAL_LETTER_A = 64
class NumberConverter(
private val sourceBase: BigInteger,
package converter
fun main() {
while (true) {
println("Enter two numbers in format: {source base} {target base} (To quit type /exit)")
val userChoice = readln()
if (userChoice == "/exit") {
break;
}
val conversionBases = userChoice.split("\\s+".toRegex()).map {
@gonaumov
gonaumov / compare.sh
Created October 5, 2022 04:57
A useful one liner for comparing files containing environment variables.
sdiff -l -w 166 .env .env-old | cat -n | grep -v -e '($' | awk -F '\\|[^[:alnum:]]+' '{print $1"| "$2}' > diff.txt

Text Statistics Tool

You are given the following text:

lorem ipsum dolor sit amet consectetur lorem ipsum et mihi quoniam et adipiscing elit.sed quoniam et advesperascit et mihi ad villam revertendum est nunc quidem hactenus ex rebus enim timiditas non ex vocabulis nascitur.nummus in croesi divitiis obscuratur pars est tamen divitiarum.nam quibus rebus efficiuntur voluptates eae non sunt in potestate sapientis.hoc mihi cum tuo fratre convenit.qui ita affectus beatum esse numquam probabis duo reges constructio interrete.de hominibus dici non necesse est.eam si varietatem diceres intellegerem ut etiam non dicente te intellego parvi enim primo ortu sic iacent tamquam omnino sine animo sint.ea possunt paria non esse.quamquam tu hanc copiosiorem etiam soles dicere.de quibus cupio scire quid sentias.universa enim illorum ratione cum tota vestra confligendum puto.ut nemo dubitet eorum omnia officia quo spectare quid sequi quid fugere debeant nunc vero a primo quidem mirabiliter occulta natura est nec perspici