Skip to content

Instantly share code, notes, and snippets.

View ChicagoDev's full-sized avatar
🇺🇸

Blake Gideon ChicagoDev

🇺🇸
View GitHub Profile
# Reading a CSV and creating a chart
import pandas as pd
import matplotlib.pyplot as plt # Provides us functions to create the visuals
# EOD Pricing for 12 instruments
data = pd.read_csv('/content/tr_eikon_eod_data.csv', #File location
index_col=0, # First column treated as an index
parse_dates=True) # Indicies are Dates
plt.plot(data['AAPL.O'])
import os
from google.cloud import texttospeech
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file('ga-service-key.json')
def synthesize_text(text):
"""Synthesizes speech from the input string of text."""
from guizero import App, PushButton
app = App("File Picker")
def pick():
app.select_file()
button = PushButton(app, text="Get File", command=pick)
# Imports ---------------
from guizero import App, Box, PushButton, Text
# Functions -------------
def clear_board():
new_board = [ [None, None, None],
[None, None, None],
[None, None, None] ]
for numberX in range(3):
def check_win():
winner = None
# Vertical lines
if (board_squares[0][0].text == board_squares[0][1].text == board_squares[0][2].text) and board_squares[0][2].text in ["X", "O"]:
winner = board_squares[0][0]
# Horizontal lines
elif (board_squares[0][0].text == board_squares[1][0].text == board_squares[2][0].text) and board_squares[2][0].text in ["X", "O"]:
winner = board_squares[0][0]
# Diagonals
elif (board_squares[0][0].text == board_squares[1][1].text ==
public class FindPairs {
public static int countPairs(int[] a) {
Integer[] pairsFound = new Integer[a.length];
// Get the ith item in the list
for (int i = 0; i < a.length; i++) {
public void function(int N) {
Stack<Integer> stack = new Stack<Integer>();
while (N > 0) {
stack.push(N % 2);
N = N / 2;
}
for (int b: stack) {StdOut.print(b);}
/******************************************************************************
* Compilation: javac LinkedStackOfStrings.java
* Execution: java LinkedStackOfStrings
* Data files: https://introcs.cs.princeton.edu/java/43stack/tobe.txt
*
* A stack of strings, implemented using a linked list.
*
* % more tobe.txt
* to be or not to - be - - that - - - is
*
/******************************************************************************
* Compilation: javac FixedCapacityStackOfStrings.java
* Execution: java FixedCapacityStackOfStrings
* Dependencies: StdIn.java StdOut.java
*
* Stack of strings implementation with a fixed-size array.
*
* % more tobe.txt
* to be or not to - be - - that - - - is
*
import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.Quick;
public class Filtering34 {
public static void minMaxFilter() {
In in = new In();
int max = in.readInt();
int min = max;