-
Open a browser
# start an instance of firefox with selenium-webdriver driver = Selenium::WebDriver.for :firefox # :chrome -> chrome # :ie -> iexplore
- Go to a specified URL
| # ------------------------------------------------------------------ | |
| # Desigining "trending topics in 24 hours sliding window" with Redis | |
| # ------------------------------------------------------------------ | |
| redis-cli del tophashes:2010-12-07-08-00 | |
| redis-cli del tophashes:2010-12-07-09-00 | |
| redis-cli del tophashes:current | |
| echo '=== 8:00 AM ===' |
| # | |
| # Test of experimental Tornado feature for a streaming request body handler, see | |
| # https://github.com/nephics/tornado/commit/1bd964488926aac9ef6b52170d5bec76b36df8a6 | |
| # | |
| # | |
| # Client sending file to server | |
| # | |
| import tornado.httpclient as httpclient |
| #!/usr/bin/env python | |
| """Split large file into multiple pieces for upload to S3. | |
| S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux | |
| box images we need to use boto's multipart file support. | |
| This parallelizes the task over available cores using multiprocessing. | |
| Usage: | |
| s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>] |
| import ( | |
| "crypto/md5" | |
| "encoding/hex" | |
| ) | |
| func GetMD5Hash(text string) string { | |
| hasher := md5.New() | |
| hasher.Write([]byte(text)) | |
| return hex.EncodeToString(hasher.Sum(nil)) | |
| } |
| // this is the background code... | |
| // listen for our browerAction to be clicked | |
| chrome.browserAction.onClicked.addListener(function (tab) { | |
| // for the current tab, inject the "inject.js" file & execute it | |
| chrome.tabs.executeScript(tab.ib, { | |
| file: 'inject.js' | |
| }); | |
| }); |
A running example of the code from:
This gist creates a working example from blog post, and a alternate example using simple worker pool.
TLDR: if you want simple and controlled concurrency use a worker pool.
extension_id=jifpbeccnghkjeaalbbjmodiffmgedin # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc"
unzip -d "$extension_id-source" "$extension_id.zip"Thx to crxviewer for the magic download URL.
| # author: | |
| # @Bartosz Kosarzycki | |
| # | |
| sudo apt-get install npm | |
| sudo npm install -g react-native-cli | |
| sudo ln -s /usr/bin/nodejs /usr/bin/node | |
| cd /home/user/your/project/path | |
| react-native init AwesomeProject | |
| cd AwesomeProject |
| /* | |
| * | |
| * This is a CasperJS script. | |
| * | |
| * It try to authenticate so the session cookie can be stored in current profile | |
| * and then BackstopJS+CasperJS+SlimerJS can use the same cookie during tests. | |
| * | |
| * Scenario | |
| * ======== | |
| * |