Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
Get Productive!

Michael Weiner mike-weiner

🕶️
Get Productive!
View GitHub Profile
@mike-weiner
mike-weiner / git-command-line-prompt.sh
Created May 21, 2022
Modifies the command line prompt to include Git repository information (if applicable).
View git-command-line-prompt.sh
# Modifies the Command Line Prompt to the following format:
# <Username> <Current Directory Name> <Current Git Branch Name (if applicable)> %
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats '(%b)'
@mike-weiner
mike-weiner / docker-alias.sh
Created May 21, 2022
An alias to start Docker Desktop from the command line.
View docker-alias.sh
alias startdocker='open -a docker'
@mike-weiner
mike-weiner / crypto-portfolio-price.py
Last active May 13, 2022
A Python script that uses the Coinbase API to get the current spot total of specified portfolio of cryptocurrencies.
View crypto-portfolio-price.py
# import required tools
import requests
from datetime import datetime
# print current date and time
print(datetime.now())
print()
# define array of cryptos & quantities owned
# TO DO: Enter Your Portfolio Holdings
@mike-weiner
mike-weiner / gh-count.sh
Last active Jan 23, 2022
A bash script that will return a count of all open issues by Github username.
View gh-count.sh
#!/bin/bash
gitUsernames=("github-username1" "github-username2")
echo "Open Issues (by user)"
echo "---"
# https://cli.github.com/manual/
for username in ${gitUsernames[@]}; do
echo -n "$username: "
@mike-weiner
mike-weiner / gh-parser.sh
Last active Jan 23, 2022
A bash script that uses the GitHub CLI and JQ to parse and print specific information about open Issues or PRs using .
View gh-parser.sh
#!/bin/bash
# Function that will print requirements if the user passes in the -help flag as the first argument
function help
{
echo "Parameters are: "
echo "[Required]: search-term"
}
# Check for '-help' flag
@mike-weiner
mike-weiner / weather-link.py
Last active Jan 10, 2022
A Python script to get all weather stations from your WeatherLink Live account (Davis Instrument weather stations). This script can serve as a template for additional WeatherLink Live API calls.
View weather-link.py
@mike-weiner
mike-weiner / opensea.py
Created Jan 5, 2022
A Python script to utilize the OpenSea API to get all available information on a single asset listed.
View opensea.py
import json
import requests
# https://opensea.io/assets/<your-asset-contract-address>/<your-token-id>
ASSETCONTRACTADDRESS = "<your-asset-contract-address>" # Replace with your Asset Contract Address
TOKENID = "<your-token-id>" # Replace with your Token ID
# Construct URL for OpenSea API to make GET call
url = "https://api.opensea.io/api/v1/asset/" + ASSETCONTRACTADDRESS + "/" + TOKENID + "/"
@mike-weiner
mike-weiner / basecamp.py
Last active Jan 3, 2022
A Python script to make calls to the Basecamp 3 API via OAuth authentication to pull data for a local CLI application. This script was not designed for commercial use.
View basecamp.py
import datetime
import json
import os.path
import requests
# Your BC Account ID
BC_ACCOUNT_ID = "<your-client-id>" # Example: 999999999 from https://3.basecamp.com/999999999/
# Basecamp App Integration Information
# Register your integration at: launchpad.37signals.com/integrations
@mike-weiner
mike-weiner / newnote.sh
Last active May 17, 2021
A bash script that will create a new file with the given name in the command line argument, save it in a specified directory, and open it in VSCode.
View newnote.sh
#!/bin/bash
#
# Script that will start VSCode with a new file saved in a specified directory to edit.
# Filename of the new file saved will be taken in as an argument
# Directory will be specified within the script
#
# Location of the directory where the files created by the script should be stored
file_location=${HOME}/Documents/Programming/scratchpad
@mike-weiner
mike-weiner / vaccine-spotter.py
Last active May 12, 2021
A Python version of a script that will use the open source Vaccine Spotter API to print out all vaccine centers in a specific city with which vaccine sites have appointments available.
View vaccine-spotter.py
import json
import requests
# get API url provided by https://www.vaccinespotter.org/api/
# this URL can be changed to any of the other states found at the URL above
URL = "https://www.vaccinespotter.org/api/v0/states/MN.json" # CHANGE STATE HERE
requestResponse = requests.get(URL)
parsedJSONResponse = requestResponse.json()