Skip to content

Instantly share code, notes, and snippets.

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
class Autotrader:
def __init__(self, url):
self.url = url
self.driver = None
self.page_num = None
self.xpath_dict = self.XPathDict()
@svirmi
svirmi / loadScript.js
Created December 11, 2019 10:42
Load script with callback
function loadScript(id, url, callback) {
const script = document.createElement('script');
script.type = 'text/javascript';
script.id = id;
script.src = url;
// Several events for cross browser compatibility.
script.onreadystatechange = callback;
script.onload = callback;
@svirmi
svirmi / run.sh
Last active January 5, 2020 13:37
run spalsh under docker
docker pull scrapinghub/splash
docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 scrapinghub/splash
# source: https://blog.scrapinghub.com/2015/03/02/handling-javascript-in-scrapy-with-splash
@svirmi
svirmi / vue2_manual_drag_and_drop.js
Created June 16, 2020 12:51 — forked from Mo3g4u/vue2_manual_drag_and_drop.js
vue.js 2.0 manual drag drop sample
<h1>User List (sort)</h1>
<p><a href="{{ basePath }}/top">Top</a></p>
<p><a href="{{ basePath }}/user/add">Add</a></p>
<div id="userList">
<table border="1">
<thead>
<tr>
<th>■</th>
@svirmi
svirmi / docker_run.sh
Last active March 31, 2021 09:17
run node.js image with current folder mapping
docker run -it --rm -p 8000:8000 -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/app node:12 /bin/bash
@svirmi
svirmi / Count lines in Git repo
Created November 11, 2020 06:35 — forked from mandiwise/Count lines in Git repo
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@svirmi
svirmi / react_on_docker2.md
Created November 19, 2020 13:47 — forked from przbadu/react_on_docker2.md
Docker configuration to run react app

Setup docker to run React app

After setting up docker to generate React app without installing node js in https://gist.github.com/przbadu/4a62a5fc5f117cda1ed5dc5409bd4ac1 It was confusing to some of the devs, how to run react app, so I am creating this as second step to the configuration.

Generate required files in your react project

cd my-react-app
touch Dockerfile Dockerfile.dev docker-compose.yml .dockerignore
@svirmi
svirmi / shrink_embeddings.ipynb
Created February 2, 2021 18:03 — forked from generall/shrink_embeddings.ipynb
Shrinking Fasttext embeddings
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svirmi
svirmi / php_cli.txt
Last active March 31, 2021 09:33
Building a PHP Command Line App with Docker
docker run -it --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/app -w /app php:cli php /app/RedirectSEO.php
https://stackoverflow.com/questions/54182191/how-to-run-a-php-script-on-docker
https://www.cloudbees.com/blog/building-a-php-command-line-app-with-docker/
$ docker run --rm -v $(pwd):/app -w /app php:cli php artisan make:command UpdateNextItem
@svirmi
svirmi / simple-exec-with-docker-remote-api.sh
Created May 31, 2021 08:35 — forked from a0xnirudh/simple-exec-with-docker-remote-api.sh
Using the exec command with the docker API, and capturing output
#! /usr/bin/env bash
# Create the container with a long running process. If PID1 exists before
# we send the exec commands, they will fail because the container is not running
#
CONTAINER_NAME="TEST-`uuidgen`"
curl --silent --unix-socket /var/run/docker.sock "http:/containers/create?name=${CONTAINER_NAME}" -XPOST \
-H "Content-Type: application/json" \
-d '{
"Image": "ruby:latest",