Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Evans fijiaaron

View GitHub Profile
@fijiaaron
fijiaaron / dependencies
Last active Nov 30, 2021
Get latest cryptocurrency prices from CoinMarketCap
View dependencies
pip install selenium
pip install pandas
pip install openpyxl
pip install sqlalchemy
pip install mysql-connector-python
pip install beautifulsoup4
pip install requests
View inspect_screenshot_from_element.py
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://one-shore.com/")
element = driver.find_element_by_css_selector(".oneshore.logo")
element.screenshot("logo.png")
driver.quit()
from PIL import Image
View podio_api_example.py
## podio_api_example.py
## Download podio python library from https://github.com/podio/podio-py
## copy podio-py/pypodio into your project directory (pip package not available on pypi)
from pypodio2 import api
## Get environment variables for Podio Credentials
from os import environ as env
@fijiaaron
fijiaaron / LoadDatabase.java
Last active Oct 28, 2020
Create database and load data from JSON
View LoadDatabase.java
import com.google.gson.Gson;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class LoadFamilyDatabase
{
@fijiaaron
fijiaaron / requirements.txt
Last active Oct 14, 2020
Scrape Craigslist for recent car posts
View requirements.txt
requests==2.24.0
beautifulsoup4==4.9.3
# setup: pip install -r requirements.txt
View uppercase.c
#include <stdio.h>
#define A 65
#define a 97
int main(int argc, char**argv)
{
int i = 1;
while(i < argc)
{
View steps.rb
#!/usr/bin/env ruby
step = "#"
space = "."
level = "\n"
steps = (ARGV.shift || 10).to_i
spaces = steps - 1
loop do
@fijiaaron
fijiaaron / pom.xml
Created Apr 13, 2020
Selenium Project setup
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>oneshore.training.tests</artifactId>
<version>1.0-SNAPSHOT</version>
View SauceAnalyticsAPIWithHttpClient.java
package com.saucelabs.api.examples.analytics;
import io.mikael.urlbuilder.UrlBuilder;
import org.junit.Test;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@fijiaaron
fijiaaron / UpdateTest.java
Created Aug 12, 2019
Update failing test with custom data about the failure
View UpdateTest.java
import com.saucelabs.saucerest.SauceREST;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.net.MalformedURLException;