Skip to content

Instantly share code, notes, and snippets.

@Jonarzz
Jonarzz / solution.sql
Created November 3, 2023 15:58
SQL Murder Mystery
select * from crime_scene_report
where date = '20180115'
and city = 'SQL City'
and type = 'murder';
select id, name
from person
where address_street_name = 'Northwestern Dr'
group by address_street_name
having max(address_number);
// appends an Untappd link to each of search results on SmakPiwa.pl site
const titles = Array.from(document.querySelectorAll('h3.abs-product-name'));
titles.forEach(title => {
const untappdLink = document.createElement('a');
untappdLink.innerText = '[UT]';
untappdLink.target = '_blank';
const name = title.innerText.replace(/[^\S ]+/g, ' ').replace('(puszka)', '').replace(/\d+( ml)?/g, '');
untappdLink.href = 'https://untappd.com/search?q=' + name.split(' ').join('+');
title.appendChild(untappdLink);
});
"""
https://github.com/qofnaught/wykop_wyzwaniepython/tree/master/edycja1
Otrzymujesz katalog zawierający 1000 plików o losowych nazwach które są wypełnione
3 losowymi znakami. Twoim zadaniem jest:
Wersja łatwa
- Odczytać rok i miesiąc modyfikacji pliku
- skopiowac wszystkie pliki z danego roku do do jednego katalogu a poźniej to samo dla miesięcy
Wersja trudna
- To co łatwa
import time
import copy
import os
import random
N = 20
M = 20
ALIVE = '#'
import string
import random
ALL_CHARS = string.ascii_letters + string.digits + string.punctuation
target = input('Enter your target text: ')
output_list = []
for _ in target:
@Jonarzz
Jonarzz / IP Address Validation (Hacker Rank)
Last active November 19, 2015 22:03
The script takes N as number of lines to read; then takes N lines and checks if the line is IPv4, IPv6 or neither.
import re
n = int(input())
for _ in range(n):
output = 'Neither'
line = str(input())
match = re.match(r'^(\d{0,3})\.(\d{0,3})\.(\d{0,3})\.(\d{0,3})$', line)
if match is not None:
#coding=utf-8
import pyaudio
import wave
import time
from datetime import datetime
import sys
def main():
# Bailey-Borwein-Plouffe formula for calculating Pi
N = 15
def calculate_pi():
pi = 0
for k in range(0, N):
dividend = dividend_for_k(k)
divider = pow(16, k)
pi += dividend/divider
import unittest
def find_anagrams(list_of_strings, word):
anagrams = []
for str_element in list_of_strings:
if len(word) == len(str_element):
list_of_chars = list(str_element)
for char in word:
import unittest
import re
def adjacent_digits_product(numb_str, digits_count):
max_product = 0
numb_str = re.sub('[\s+]', '', numb_str)
for i in range(len(numb_str) - digits_count):
sub_str = numb_str[i:i+digits_count]