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
''' | |
Task 1: Box calculator | |
This table shows available box sizes and the number of items each can hold: | |
+--------+-------+ | |
| Size | Items | | |
+--------+-------+ | |
| Big | 5 | | |
| Medium | 3 | |
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
# Based on https://github.com/yogeshp1426/IMDB_Top_50_Web_Scrapper/blob/master/IMDB_csv_out.ipynb | |
from bs4 import BeautifulSoup as soup | |
from urllib.request import urlopen | |
import csv | |
IMDb_url = ( | |
"https://www.imdb.com/search/title/?sort=num_votes,desc&start=1&title_type=feature&year=1950,1960") | |
connection = urlopen(IMDb_url) | |
page_html = connection.read() |
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
# This time let's not use a string for the operation parameter. | |
# Since it's an either-or choice, a Boolean will do nicely. | |
# For an explanation of the use of the "*" in the definition block, see | |
# https://ivergara.github.io/boolean-arguments-to-functions-in-python.html | |
def calculate(x: int, y: int = 1, *, subtract: bool = False) -> int: | |
"""Calculates the sum (or difference) of two numbers. |
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
for ((i = 1; i < 11; i++)); do touch io$i.py; done |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<array> | |
<dict> | |
<key>phrase</key> | |
<string>Māori</string> | |
<key>shortcut</key> | |
<string>maori</string> | |
</dict> |
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
Overall: https://regex101.com/r/kh1HG2/1 | |
Inner: https://regex101.com/r/fMwcsz/1 |
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
# https://wcqs-beta.wmflabs.org/ | |
SELECT ?pageid ?file ?title | |
(GROUP_CONCAT(DISTINCT ?mi_label;separator="; ") as ?miLabel) | |
(GROUP_CONCAT(DISTINCT ?en_label;separator="; ") as ?enLabel) | |
WITH { | |
SELECT * WHERE { | |
SERVICE wikibase:mwapi | |
{ |
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
# Prepends "J:\" to each line, copies to current directory -- specify with -Destination param, per | |
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/copy-item | |
# Add "-wi" (or ("--WhatIf") for a dry run | |
Get-Content .\list.txt | ForEach {Copy-Item J:\$_ -verbose} |
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 glob | |
num_files = len(glob.glob('*.jpg')) | |
if num_files > 0: | |
print("Found {0} JPEG files".format(num_files)) | |
jpeg_files = glob.iglob('*.jpg') | |
for count, filename in enumerate(jpeg_files, start=1): | |
print("----\n") | |
percent_complete = int((count * 100) / num_files) | |
print("File: {0} ({1} of {2}; {3}%).".format( |
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
' From https://stackoverflow.com/questions/67066414/ | |
Public Function checkExists(fPath As String) As Boolean | |
If fPath <> "" Then | |
If Dir(fPath, vbNormal + vbDirectory) <> "" Then | |
checkExists = True | |
End If | |
End If | |
End Function |
NewerOlder