Skip to content

Instantly share code, notes, and snippets.

View fijiaaron's full-sized avatar

Aaron Evans fijiaaron

View GitHub Profile
@fijiaaron
fijiaaron / DynamoDB.ts
Created October 9, 2024 13:53 — forked from aevans-mms/DynamoDB.ts
AWS DynamoDB TypeScript Commands Wrapper and Simple Class
import * as dynamodb from "@aws-sdk/client-dynamodb"
const commands = {
"client" : (params:dynamodb.DynamoDBClientConfig) => new dynamodb.DynamoDBClient(params),
"listTables" : (params:dynamodb.ListTablesCommandInput) => new dynamodb.ListTablesCommand(params),
"describeTable" : (params:dynamodb.DescribeTableCommandInput)=>new dynamodb.DescribeTableCommand(params),
"query" : (params:dynamodb.QueryCommandInput) => new dynamodb.QueryCommand(params),
"scan" : (params:dynamodb.ScanCommandInput) => new dynamodb.ScanCommand(params),
"getItem" : (params:dynamodb.GetItemCommandInput) => new dynamodb.GetItemCommand(params),
"putItem" : (params:dynamodb.PutItemCommandInput) => new dynamodb.PutItemCommand(params),
//STX12//830HR8001 20220806220113 9 HR8 01009 SH202208062022080620240121921128 9211280001 215610 0250600209 E 5500049044 EA000 03SUBASH KRISHNAN 04+0000000000000090AD20220805 04+0000000000000075DW20220808 04+0000000000000105DW20220815 04+0000000000000330DW20220822 04+0000000000000210DW20220829 04+0000000000000000DW20220905 04+0000000000000345DW20220912 04+0000000000000165DW20220919 04+0000000000000240DW20220926
## check_for_distinct_paths.py
"""
Given a list of paths, return a list of distinct paths:
If path1 is the same as path2, they are considered duplicates.
For example:
>>> get_distinct_paths(['abc/def', 'abc/def'])
['abc/def']
# You have a basket of socks
# There are a random assortment of socks
# They may have pairs
# Pick a sock out of the basket
# Keep pickings socks, one a time, until you have gone through them all
# Every time you find a match, put them together and set aside
import random
# random.seed(1)
/**
* rabbithole.js
*
* There are 100 holes, all in a row, and a long tunnel connecting them.
* A rabbit lives down there, and you're trying to catch him.
* The rabbit starts down 1 one of the holes, but you don't know which.
* Every time you look down into a hole the rabbit moves.
* But he only moves one hole -- either left or right.
* How can you find the rabbit? And how long will it take?
*
@fijiaaron
fijiaaron / dependencies
Last active November 30, 2021 18:42
Get latest cryptocurrency prices from CoinMarketCap
pip install selenium
pip install pandas
pip install openpyxl
pip install sqlalchemy
pip install mysql-connector-python
pip install beautifulsoup4
pip install requests
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
## 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 October 28, 2020 22:18
Create database and load data from JSON
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 October 14, 2020 00:41
Scrape Craigslist for recent car posts
requests==2.24.0
beautifulsoup4==4.9.3
# setup: pip install -r requirements.txt