Skip to content

Instantly share code, notes, and snippets.

@CubeVic
CubeVic / bonus_percentage_distribution.py
Created April 11, 2024 06:45
Script to produce a histogram type of graphic that will represent the bonus percentage distribution
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
def plot_distribution(data):
plt.hist(data, bins=10, color='blue', edgecolor='black')
# plt.xlabel('Decimal Numbers')
plt.ylabel('Frequency')
@CubeVic
CubeVic / makefile
Created March 24, 2024 06:07
Make file for Golang projects, this will save time and will run 3 commands, to format validate and finally build the executable.
.DEFAULT_GOAL := build
.PHONY:fmt vet build
fmt:
go fmt ./...
vet: fmt
go vet ./...
build: vet
@CubeVic
CubeVic / .pre-commit-config.yaml
Created January 9, 2024 06:42
Pre-commit hooks to run on a quality github action - this is focus on python files
exclude: ^(models/|core_framework/|utils/|.github|jenkins|jenkins_utils)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- id: check-merge-conflict
- id: check-symlinks
@CubeVic
CubeVic / docker-help.md
Created February 27, 2023 09:50 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@CubeVic
CubeVic / Download_files_from_saucelabs.py
Created November 30, 2022 17:18
Download a zip file from Saucelabs with built-in libraries, unzip in-place.
import os
from urllib import request
import ssl
from zipfile import ZipFile
from io import BytesIO
url = URL+saucestorage_id
ssl._create_default_https_context = ssl._create_unverified_context
@CubeVic
CubeVic / Dockerfile
Last active November 23, 2022 04:11
Flask site to upload directories
FROM alpine:latest
RUN apk update
RUN apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers
RUN apk add python3
RUN apk add py3-pip
WORKDIR /app
COPY ./requirements.txt /app
RUN pip3 --no-cache install -r requirements.txt
@CubeVic
CubeVic / pre_run.bat
Created November 23, 2022 02:36
Example of a pre_run executable generate programmatically and targeting a windows platform
@echo off
mkdir %HOMEPATH%\prerun
curl -u "$SUACELABS_USERNAME:$SAUCELABS_AUTHTOKEN" --location --request GET "https://api.us-west-1.saucelabs.com/v1/storage/download/$FILE_ID" --output %HOMEPATH%\prerun\suaceLabFile.zip &
curl -u "SUACELABS_USERNAME:$SAUCELABS_AUTHTOKEN" --location --request GET "https://api.us-west-1.saucelabs.com/v1/storage/download/$FILE_ID" --output %HOMEPATH%\prerun\unzip_file.py &
cd %HOMEPATH%\prerun
python unzip_file.py suaceLabFile.zip Chrome
@CubeVic
CubeVic / unzip_file.py
Created November 22, 2022 10:30
Python script that will unzip a file, it required two arguments when it is call for execution. First, the zipped file, second folder name where all the content of the zip file will be drop.
from zipfile import ZipFile
from os import getcwd, path
import sys
zipped_file = sys.argv[1]
folder_name = sys.argv[2]
print(zipped_file)
base_dir = str(getcwd())
path_zipped = path.join(base_dir,zipped_file)
print(path_zipped)
@CubeVic
CubeVic / Chrome_pre_run.sh
Created November 7, 2022 04:05
Pre run file to download, unzip and create a folder to later be use on chrome capabilities `user-data-dir`. Zip File will contain the files of a previous session where the user is logged to the webapp
#!/bin/bash
# Chrome Pre-run v0.9
# Use to download and create a file to later be use for browser user-data-dir
# by Victor
# >>>>>>> functions <<<<<<<<<<
function make_dir(){
mkdir $1
echo ">>>>>>>>>>>>>>>>Making directory"
if [ -d "$1" ]
@CubeVic
CubeVic / selenium-setup.sh
Created October 4, 2022 00:35 — forked from xd003/selenium-setup.sh
Bash Script to setup Python + Selenium + chromedriver on a Headless Chrome Browser
#!/usr/bin/env bash
echo "This script will setup webdriver of your choice for selenium and create a template script with appropriate settings"
sleep 2
echo "This Script only supports Linux 64 bit and arm64/aarch64 kernel architecture currently"
sleep 2
uname="$(uname -m)"
case $uname in
arm64|aarch64|x86_64 )