Skip to content

Instantly share code, notes, and snippets.

View 0xIslamTaha's full-sized avatar
🤩
code with love ... test with imagination

Islam Taha 0xIslamTaha

🤩
code with love ... test with imagination
View GitHub Profile
@0xIslamTaha
0xIslamTaha / command.js
Created April 13, 2020 13:47
custom matchImageSnapshot command
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
const snapshotsFolder = Cypress.config('customSnapshotsDir');
const waitForFirstTime = Cypress.config('waitForFirstTime');
addMatchImageSnapshotCommand();
Cypress.Commands.add(
'waitMatchImageSnapshot',
{
prevSubject: 'optional',

Find elements:

  • Cypress get or find selecet elements based on (CSS selectors)[https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors]
  • Cypress get looks in the whole DOM and it usually returns #all# elements matching the selecotr. You can use .eq(n) to get the nth element.
  • Cypress find ususally used after get and looks inside the parent element.

Find elements attributes (href):

  • cy.get('css_selector').its('href')
  • cy.get('a').each( ($element, index, $list){ cy.wrap($element).its('href');
# remove all docker containers
docker rm -f $(docker container ls -aq)
# remove all none images
docker image rm -f $(docker images -a | grep none | awk -F' ' '{ print $3 }')
docker image rm -f $(docker images -a | grep -v "4f80eab7b180" | grep -v "f6dcbb25c0cf" | grep -v "b1f100cb322d" | grep -v "ac95afc1ca99" | grep -v "101b64121fd9" | awk 'NR>1 {print $3}' )
docker volume rm $(docker volume ls -q)
```bash
➜ 1lims-automation git:(master) docker run --rm -e ENVIRONMENT=rlr-eu-stg -e CONSUL_HOST=consul.rlr-eu-stg -e CONSUL_HTTP_TOKEN=e4ec2141-615c-4e6c-8da2-35d2be829bbe -p 8080:80 relayr/cloud-modules-user:C20-3882_alerts_export_7
Unable to find image 'relayr/cloud-modules-user:C20-3882_alerts_export_7' locally
C20-3882_alerts_export_7: Pulling from relayr/cloud-modules-user
000eee12ec04: Pull complete
eb22865337de: Pull complete
bee5d581ef8b: Pull complete
8da38cb359e1: Pull complete
2778de1d4ad1: Pull complete
090d948fd933: Pull complete
@@||kora-live.tv^$generichide
kora-live.tv/##script:inject(bab-defuser.js)
kora-live.tv/##script:inject(cookienotice.js)
kora-live.tv/##script:inject(advertisement.js)
kora-live.tv/##script:inject(advertisement.js)
kora-live.tv/##script:inject(crypta.js)
cryptaloot.pro/##script:inject(crypta.js)
from Jumpscale import j
server = j.servers.openresty.get("test")
server.install(reset=True)
server.configure()
website = server.websites.get("test")
website.ssl = False
locations = website.locations.get("main")
website_location = locations.locations_static.new()
website_location.name = "home"
def tomato_cheese(c, t):
if t % 2 != 0 or c <= 0 or t <= 0 or t/2 < c:
return [-1, -1]
if t/2 == c:
return [int(t/2), 0]
mini, big = 0, 0
if t/2 > c:
t = t - 4
@0xIslamTaha
0xIslamTaha / saberDav_php_nginx.md
Last active July 25, 2019 08:06
saberDav, php, nginx installation steps

1- Installation steps:

apt-get install -y nginx php php-fpm php-mysql htop vim php7.2-xml php-mbstring unzip php-curl
mkdir /var/www/html/saberdav 
cd /var/www/html/saberdav
mkdir data public
php -r "readfile('http://getcomposer.org/installer');" > composer-setup.php && php composer-setup.php --install-dir=/usr/bin --filename=composer && php -r "unlink('composer-setup.php');" && composer require sabre/dav ~3.2.0 

2- Create server.php:

echo "prepare docker"
apt-get update && apt-get upgrade
apt-get install -y zsh git ipython3 python3-dev python3-pip git xvfb tmux wget curl vim unzip libnspr4 libnss3 lsb-release xdg-utils libxss1 libdbus-glib-1-2 fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
echo "Install latest stable chrome"
CHROME_SETUP=google-chrome.deb && wget -O $CHROME_SETUP "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && dpkg -i $CHROME_SETUP && apt-get install -y -f && rm $CHROME_SETUP
sudo apt-get update && apt-get upgrade
cd ~/builds/
git clone https://github.com/travis-ci/travis-build.git
cd travis-build/
gem sources -a http://rubygems.org
rvm install 2.3.0
rvm --default use 2.3.0
gem install travis
gem install bundler --pre
sed -i 's/https:/http:/g' Gemfile