Skip to content

Instantly share code, notes, and snippets.

View andreasneuber's full-sized avatar
🎯
Focusing

Andreas Neuber andreasneuber

🎯
Focusing
View GitHub Profile
@andreasneuber
andreasneuber / jenkins-docker-ec2.sh
Last active July 19, 2020 18:13
Install Jenkins and Docker on Ubuntu Server 18.04 EC2 instance
# Create a Ubuntu Server 18.04 LTS instance
# Associate an Elastic IP to instance - https://docs.bitnami.com/aws/faq/configuration/configure-static-address/
# Add inbound security group rule..
# Custom TCP TCP 8080 0.0.0.0/0
# Install Java and Docker
sudo apt update
sudo apt install -y openjdk-8-jdk
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@andreasneuber
andreasneuber / add-domain-to-hosts-file.bat
Created July 19, 2020 18:22
Windows - Batch for adding entries to host file
@ECHO OFF
TITLE=Update Hosts File
set /p ip_address="Enter ip adress: "
set /p domain="Enter domain: "
copy C:\Windows\System32\drivers\etc\hosts C:\Windows\System32\drivers\etc\hosts.bck
ECHO. >> C:\Windows\System32\drivers\etc\hosts
ECHO %ip_address% %domain% >> C:\Windows\System32\drivers\etc\hosts
PAUSE
@andreasneuber
andreasneuber / add-alias.sh
Created July 19, 2020 18:25
Add alias command to Ubuntu / Linux-Lite - one-liner
echo "alias aliasname='command'" >> ~/.bash_aliases && source ~/.bash_aliases
@andreasneuber
andreasneuber / aws-cli-ubuntu-16-install.sh
Created July 19, 2020 18:42
Install AWS cli on Ubuntu 16
sudo apt-get -y install python3-pip
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
aws --version
@andreasneuber
andreasneuber / ruby-cli-ubuntu-simple-example.txt
Last active July 19, 2020 18:57
Create simple Ruby Cli script - Ubuntu
$ sudo apt-get -y update
$ sudo apt-get -y install ruby
$ echo 'export PATH="$PATH:$HOME/bin"/' >> ~/.bashrc
$ sudo touch /bin/allgood && sudo chmod 755 /bin/allgood
$ sudo nano /bin/allgood
# Then add this into the "allgood" file
--------------------------------------------
#!/usr/bin/env ruby
@andreasneuber
andreasneuber / cc-grab-urls.php
Last active November 6, 2021 15:35
Codeception - grab all urls with specific segment from a page
private function extract_all_page_links( AcceptanceTester $I ): array {
$I->amOnPage( '/example/' );
$url = $this->base_url . 'example/';
$aLinks = $I->grabMultiple( "//a[contains(@href,'{$url}' )]", 'href' );
return array_unique( $aLinks );
}
@andreasneuber
andreasneuber / cc-quick.bat
Last active October 4, 2022 06:49
For an even quicker Codeception quickstart on Windows 10 ;-)
for /f "delims=" %%a in ('wmic OS get localdatetime ^| find "."') do set datetime=%%a
set "YYYY=%datetime:~0,4%"
set "MM=%datetime:~4,2%"
set "DD=%datetime:~6,2%"
set "HH=%datetime:~8,2%"
set "MI=%datetime:~10,2%"
set "SS=%datetime:~12,2%"
set fullstamp=%YYYY%-%MM%-%DD%-%HH%-%MI%-%SS%
@andreasneuber
andreasneuber / throttle-network-speed.spec.ts
Created July 22, 2023 15:32
Throttle network speed via Playwright CDPSession
// See also https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-emulateNetworkConditions
import { test, chromium } from '@playwright/test';
test("throttle network speed to 2.1 Mbps", async ({ }) => {
const browser = await chromium.launchPersistentContext("");
const page = await browser.newPage();
const client = await page.context().newCDPSession(page);
await client.send("Network.enable");
await client.send("Network.emulateNetworkConditions", {
@andreasneuber
andreasneuber / general-approach-test-preps-via-AWS-Lambda.txt
Last active November 18, 2023 13:45
General approach - Preps before test execution on web app using AWS/RDS
If web app uses AWS RDS for database, then the following can be done:
- AWS Lambda function executes DB queries directed to RDS
- Trigger of Lambda function -> AWS API Gateway (RestAPI)
- Test suite can trigger REST API call on start