How to use:
./wordle.sh
Or try the unlimit mode:
I've recently encountered an article that showed some ways to speed up one's Python code. Some of these methods seemed rather peculiar, so I decided to do some extra complex data analysis to try to understand whether these methods actually work.
Python version: 3.7.1
Here's a quick summary of the methods proposed in that article that I found odd.
The article said that, since for loops are "dynamic" (not sure what this means), they're slower than while loops. I compared the following two loops and found that, on average, the for loop was about 2.5 times faster than the corresponding while loop:
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # ------------------------------------------------------------------------- | |
| # - | |
| # Python Module Argument Parser - | |
| # - | |
| # Created by Fonic <https://github.com/fonic> - | |
| # Date: 06/20/19 - 04/03/24 - | |
| # - |
| #!/bin/bash | |
| # from https://chromium.woolyss.com/ | |
| # and https://gist.github.com/addyosmani/5336747 | |
| # and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md | |
| sudo apt-get update | |
| sudo apt-get install software-properties-common | |
| sudo add-apt-repository ppa:canonical-chromium-builds/stage | |
| sudo apt-get update | |
| sudo apt-get install chromium-browser | |
| chromium-browser --headless --no-sandbox http://example.org/ |
| #deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted | |
| # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
| # newer versions of the distribution. | |
| deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted | |
| # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted | |
| ## Major bug fix updates produced after the final release of the | |
| ## distribution. | |
| deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted |
| #!/usr/bin/env bash | |
| # https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
| # https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
| # https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
| # https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
| # https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
| # https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
| # Versions | |
| CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE` |
| curl --include \ | |
| --no-buffer \ | |
| --header "Connection: Upgrade" \ | |
| --header "Upgrade: websocket" \ | |
| --header "Host: example.com:80" \ | |
| --header "Origin: http://example.com:80" \ | |
| --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ | |
| --header "Sec-WebSocket-Version: 13" \ | |
| http://example.com:80/ |
| node { | |
| echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1' | |
| echo 'No quotes, pipeline command in single quotes' | |
| sh 'echo $BUILD_NUMBER' // 1 | |
| echo 'Double quotes are silently dropped' | |
| sh 'echo "$BUILD_NUMBER"' // 1 | |
| echo 'Even escaped with a single backslash they are dropped' | |
| sh 'echo \"$BUILD_NUMBER\"' // 1 | |
| echo 'Using two backslashes, the quotes are preserved' | |
| sh 'echo \\"$BUILD_NUMBER\\"' // "1" |
I have been testing various ways to read and write text files with GZIP in Python. There were a lot of uninteresting results, but there were two I thought were worth sharing.
If you have a big list of strings to write to a file, you might be tempted to do:
f = gzip.open(out_path, 'wb')
for line in lines: