Skip to content

Instantly share code, notes, and snippets.

View FrederickGeek8's full-sized avatar
📚
Looking for grad school opportunities

Frederick Morlock FrederickGeek8

📚
Looking for grad school opportunities
View GitHub Profile
@FrederickGeek8
FrederickGeek8 / foo_bar.py
Last active June 4, 2023 00:19
A cursed Pythonic way of doing FooBar interview questions in 2 conditional statements. I got bored after hearing my friend talk about her interview.
def foo_bar(n: int):
""" A function to interate through `n` numbers and print "Foo" if i is divisible by 3
And "Bar" i is divisible by 5 and "FooBar" if i is divisible by 5 and 3.
Args:
n: The number of print to make
"""
for i in range(n):
string = ''
@FrederickGeek8
FrederickGeek8 / creating-a-headless-raspberry-pi.md
Created February 14, 2021 09:47
After attempting to get my brand-new Raspberry Pi up and running, I encountered some issues that others may face along the road. This guide aims to address and walk you through setting up your Raspberry Pi. All that is needed is a working internet connection and a microSD card reader!

Creating a Headless Raspberry Pi

After attempting to get my brand-new Raspberry Pi up and running, I encountered some issues that others may face along the road. The Raspberry Pi Zero I am using has this Wi-Fi dongle, though I highly recommend this one. The assumption of this article is that you have some experience using macOS Terminal, though minimal knowledge is required.

A good guide for configuring a headless Raspberry Pi Zero is this article written by David Maitland. Unfortunately, his method did not work for me, something I hope to amend through this article. I will be building off much of what David said so that others running macOS may see greater successes.

This was a difficult process for myself because I lacked any of the tools necessary to normally set up a Raspberry Pi. I did not have any displays, cables, keyboard, mice, access to the router – the only items at my dispo

@FrederickGeek8
FrederickGeek8 / requirements.txt
Last active June 28, 2023 09:54
WASD.tv Chat API Client in Python
requests==2.24.0
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
websocket-client==0.57.0
@FrederickGeek8
FrederickGeek8 / crash.log
Created December 1, 2019 13:28
Microsoft Python Language Server version 0.4.114.0 crash when viewing simple file
[Info - 9:25:11 PM] Analysis cache path: /Users/fred/Library/Caches/Microsoft/Python Language Server
[Info - 9:25:11 PM] Microsoft Python Language Server version 0.4.114.0
[Info - 9:25:11 PM] Workspace root:
[Info - 9:25:12 PM] GetCurrentSearchPaths /Users/fred/.pyenv/shims/python
[Info - 9:25:12 PM] Interpreter search paths:
[Info - 9:25:12 PM] /Users/fred/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7
[Info - 9:25:12 PM] /Users/fred/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/lib-dynload
[Info - 9:25:12 PM] /Users/fred/Library/Python/3.7/lib/python/site-packages
[Info - 9:25:12 PM] /Users/fred/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages
[Info - 9:25:12 PM] User search paths:
@FrederickGeek8
FrederickGeek8 / solutions_hard.py
Created October 16, 2019 14:52
Solutions for the "hard" problems in the Fall 2019 SPLICE Club "Get to know Python" workshop
# Problem 1
# blank board
tic_tac_toe = [
['□', '□', '□'],
['□', '□', '□'],
['□', '□', '□']
]
# Problem 2
def show_board(board):
@FrederickGeek8
FrederickGeek8 / solutions_easy.py
Created October 16, 2019 12:44
Solutions for the "easy" problems in the Fall 2019 SPLICE Club "Get to know Python" workshop
def say_hello():
for i in range(10):
print("Are we there yet")
# say_hello()
def is_even(x):
if x % 2 == 0:
return True
else:
@FrederickGeek8
FrederickGeek8 / riffle_problem.py
Created February 6, 2018 04:24
Solution for Part (b) of the 3rd Question of Section 3.3 in "Introduction to Probability" by Grinstead and Snell
import numpy as np
def riffle(deck, n_times=1):
for i in range(n_times):
deck2 = []
split = np.random.binomial(len(deck), 1/2, 1)[0]
half1 = deck[:split]
half2 = deck[split:]
while len(half1) + len(half2) > 0:
@FrederickGeek8
FrederickGeek8 / bullet-train.zsh-theme
Created January 31, 2018 14:57
My modified Bullet Train Theme
# README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# Terminal.app - it has significantly better color fidelity.
@FrederickGeek8
FrederickGeek8 / .zshrc
Created January 29, 2018 07:05
My zsh configuration
# Path to your oh-my-zsh installation.
export ZSH=/Users/fred/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="bullet-train"
# Uncomment the following line to use case-sensitive completion.
@FrederickGeek8
FrederickGeek8 / download.py
Last active January 16, 2018 03:51
Script for downloading Panopto courses – made for CMU 10-701
"""
Built on Python 3.6.3
Requires progressbar2 (install with pip)
"""
import xml.etree.ElementTree as xml
import urllib.request as urllib
import progressbar
pbar = None
# Get URL from "Subscribe to RSS" button