Categories
Uncategorized

Selenium test with docker-compose

In case using selenium standalone during test.

docker-compose YAML

  version: '3'
    services:
      test:
        depends_on:
          - selenium
        environment:
          - E2ETEST_HOST=test
          - SELENIUM_PORT=4444
          - SELENIUM_HOST=selenium
        build:
          context: .
          dockerfile: Dockerfile
        ports:
          - 80
          - 443
        command: run_test.sh
      selenium:
        image: selenium/standalone-chrome
        ports:
          - 4444

nightwatch config sample

"test_settings": {
    "default": {
        "selenium_port"  : parseInt(process.env.SELENIUM_PORT) || 4444,
        "selenium_host"  : process.env.SELENIUM_HOST,
        "silent": true,
        "desiredCapabilities": {
            "browserName": "chrome",
            "javascriptEnabled": true,
            "acceptSslCerts": true,
            "chromeOptions" : {
                "args" : ["--no-sandbox"]
            }
        }
    }

run_test.sh

docker-compose down
docker-compose up --force-recreate --build --abort-on-container-exit --exit-code-from test test
Categories
Uncategorized

AWS KMS – two liners

For binary encrypted output:

aws kms encrypt --region ap-southeast-2 --key-id alias/blah --plaintext fileb://blah --output text --query CiphertextBlob | base64 --decode > blah.enc
aws kms decrypt --ciphertext-blob fileb://blah.enc --output text --query Plaintext | base64 --decode

For base64 encrypted output:

aws kms encrypt --region ap-southeast-2 --key-id alias/blah --plaintext fileb://blah --output text --query CiphertextBlob > blah.enc
aws kms decrypt --ciphertext-blob fileb://<(cat blah.enc | base64 --decode) --output text --query Plaintext | base64 --decode

or try:
https://github.com/realestate-com-au/shush

Categories
Uncategorized

User Profile Service failed the logon. User profile cannot be loaded.

https://support.microsoft.com/en-us/contact/menu/software/windows/ts/

https://support.microsoft.com/en-au/help/947215/you-receive-a-the-user-profile-service-failed-the-logon-error-message

Had to contact Microsoft support to receive default file.
Download

Categories
Uncategorized

Curl net performance test

Print out CloudFront X-Amz-Cf-Id when response time is slower than set threshold.

#!/bin/bash

output=($(curl -I -s -w "Time: %{time_total}\n"  http://cf_url.here grep -e X-Amz-Cf-Id -e Time | awk {'print $2'}))

id=${output[0]}
time=${output[1]}
compare=0.01

if (( $(echo "$time > $compare" |bc -l) )); then
    echo $time - $id >> test_results.txt
fi

Small variation (unrelated to CF)

#!/bin/bash
while :
do
output=($(curl -o /dev/null -s -w "time_namelookup: %{time_namelookup}\n time_connect: %{time_connect}\n time_appconnect: %{time_appconnect}\n time_pretransfer: %{time_pretransfer}\n time_redirect: %{time_redirect}\n time_starttransfer: %{time_starttransfer}\n time_total: %{time_total}\n" http://services.realestate.com.au/services/listings/120542701 | grep time_ | awk {'print $2'}))

time_namelookup=${output[0]}
time_connect=${output[1]}
time_appconnect=${output[2]}
time_pretransfer=${output[3]}
time_redirect=${output[4]}
time_starttransfer=${output[5]}
time_total=${output[6]}
compare=0.1

if (( $(echo "$time_total &gt; $compare" |bc -l) )); then
echo $time_namelookup,$time_connect,$time_appconnect,$time_pretransfer,$time_redirect,$time_starttransfer,$time_total &gt;&gt; test_results.txt
fi
sleep 1
done
Categories
Uncategorized

Replace Mercedes-Benz B250 cabin(pollen) filter replacement DIY

Quoted $300+ from dealer shop which I know a serious rip-off price for mere carbon filter.

Searched eBay, local stock comes with some $100 price tag, still too steep.

Found a German seller, selling compatible filter for approx. $27 for the item and $15 shipping – even made in Germany!

The confusing part was finding b250 cabin filter replacement in YouTube resulting the previous model, W245(2005-2011).
Any 2012~ model need to search for W246 instead, like this.

5-10 minutes work, don’t even need a screw driver. Boom, saved $250+.