Skip to content

Instantly share code, notes, and snippets.

@sudoxx2
sudoxx2 / deviceinvent.sql
Created October 30, 2019 05:56
template for sql inventory db
#create a database
CREATE DATABASE avitek;
#create employees table
USE avitek;
CREATE TABLE employees (
id int NOT NULL AUTO_INCREMENT,
first_name varchar(255),
last_name varchar(255),
@sudoxx2
sudoxx2 / hello_world
Created June 15, 2019 07:32
simple hello world program for bash scripting
#!/bin/bash
# My first script
echo "Hello World!"
# check if python is installed - it should return something similiar to this "Python 3.6.7"
python --version
# check if pip is installed - it should return something similiar to this "pip 19.1.1 from <your_path>"
pip --version
@sudoxx2
sudoxx2 / runpy.txt
Last active June 4, 2019 06:37
run python file
# run the python file you just created in the current directory(should be headless_test dir)
python automate_download.py
@sudoxx2
sudoxx2 / automate_file_download.py
Last active October 29, 2023 18:34
automate_download
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
# function to take care of downloading file
def enable_download_headless(browser,download_dir):
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')
params = {'cmd':'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}}
browser.execute("send_command", params)
# install selenium
pip install selenium
@sudoxx2
sudoxx2 / gist:ab9e4c4457e1c8e58666c1a5a3bd11b7
Last active June 4, 2019 06:28
Fourth Step: Creating our virtual environment
# This command will install virtualenv
pip install virtualenv
# This command will create our virtual env with python3 installed
virtualenv -p python3 env
# ONLY RUN THIS COMMAND if you get an error from the above command(windows users issue perhaps)
virtualenv -p python env
# This command will activate our virtual envirnoment and allow us to work with contained dependencies
source env/bin/activate
# make directory/folder to store our project files
mkdir headless_test
# change directory to the directory we just created
cd headless_test