Code samples to demonstrate Python iterators and the use of yield statements to create a generator.
Examples based directly on the instruction from Programiz' YouTube Channel
Code samples to demonstrate Python iterators and the use of yield statements to create a generator.
Examples based directly on the instruction from Programiz' YouTube Channel
A tedious because Lambda's Python 3.8 runtime does not include all of the typical build tools to generate Weasyprint's dependencies.
Also included here are steps to generate fonts, because Lambda doesn't have any and while it is interesting to look at a fully formatted document where all of the characters are .notdef glyphs, it's more productive to be able to read your pretty new PDF file.
The files in this gist are "flat" because gist does not allow us to show directories, so note the following dir structure:
import time | |
some_list = [1,2,3,4,5,6] | |
counter = 0 | |
for file in some_list: | |
counter += 1 | |
percent = round((counter/len(some_list))*100, 2) | |
message = "==== Progress: " + str(percent) + "% ====" | |
if percent < 100: | |
# this line ending and buffer-flush allow us to re-write over this line again | |
print(message, end='\r', flush=True) |
for fn in *; do printf "$fn::" ; cat $fn ; printf "\n"; done |
# curl https://gist.githubusercontent.com/matthewpoer/5b09ea547bbdd7cdc304deb778465344/raw/93154518e28736d6e71a09dbb4176d6b0d5fac91/conky.conf --output ~/.config/conky/conky.conf | |
conky.config = { | |
alignment = 'top_right', | |
background = false, | |
border_width = 0.5, | |
cpu_avg_samples = 4, | |
default_color = 'white', | |
default_outline_color = 'grey', | |
default_shade_color = 'black', |
<?php | |
$a = array( | |
'one', | |
'two', | |
'three', | |
); | |
$b = array( | |
'four', | |
'five', |
#!/usr/bin/env bash | |
set -e | |
# You'll need to set these variables here or with an environment variable | |
# mysqlPassword | |
# mysqlHostname | |
# mysqlUsername | |
# mysqlDatabase | |
# List out the tables you want to copy down, |
<?php | |
$input = null; | |
$handle = fopen("php://stdin","r"); | |
while($input != 'You are pretty') { | |
echo 'Tell me I\'m pretty.' . PHP_EOL; | |
$input = trim(fgets($handle)); | |
} | |
echo 'You don\'t mean it' . PHP_EOL; | |
die(1); |
<?php | |
echo "Counting to 10" . PHP_EOL; | |
for($i = 0; $i < 10; $i++) { | |
echo "Count is at {$i}\r"; | |
usleep(500000); // half of one second | |
} | |
echo "Count is at {$i}" . PHP_EOL; |