Skip to content

Instantly share code, notes, and snippets.

View jsgoller1's full-sized avatar
🖖
I hate computers

Joshua Goller (he/him) jsgoller1

🖖
I hate computers
View GitHub Profile
@jsgoller1
jsgoller1 / interviews.md
Last active April 2, 2023 12:17
How to Slay Programming Interviews

How to slay programming interviews

This gist is currently under re-development after my most recent round of interview prep and will be re-posted with major edits soon.

@jsgoller1
jsgoller1 / pyramid.py
Last active June 25, 2021 00:19
Everyone has to start somewhere....
"""
This was the first challenging programming assignment I ever tried to complete,
given as an early homework question when I took CS220 (Introduction to Programming with Python)
in Fall 2011 at the College of Charleston (we had just learned about conditionals and iteration).
I was 21 years old, and was learning computer programming for the very first time.
The prompt was: "write a program that takes as input a symbol and a number, then prints a center-justified
pyramid of the given symbols and the height of the given number."
I stayed overnight in the computer lab, chugging energy drinks and banging my head against the desk
@jsgoller1
jsgoller1 / venvs.md
Created July 17, 2020 18:35
Hello virtual environments (for NU)

Virtual environments ("venvs") make setting up Python projects easy, especially for projects multiple people work on. First, we need to create the venv:

joshua.goller @ joshua-goller ~/Code/skip-example
└─ $ ▶ python3 -m venv ./venv
joshua.goller @ joshua-goller ~/Code/skip-example
└─ $ ▶ ls
venv
(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))))
(define generic-eq?
(lambda (item1 item2)
(cond ((and (number? item1) (number? item2)) (= item1 item2))
((and (atom? item1) (atom? item2)) (eq? item1 item2))
((and (list? item1) (list? item2)) (list-eq? item1 item2))
@jsgoller1
jsgoller1 / notes-for-new-players.md
Last active March 23, 2019 22:23
Notes for new D&D players

Notes for new players

Here's a quick intro to D&D to help you get ready for your first campaign.

The purpose of D&D is to have fun

  • D&D is a storytelling and roleplaying game; there is no specific victory condition or loss condition, except those designated by the story.
  • D&D has a lot of rules, many of which are common RPG tropes (such as XP, turn based combat, spellcasting, etc) but there is no "right way" to play D&D. Having fun takes precedence over following the rules - the only "wrong way" to play is if any players are having a bad time. As such, some DMs will be more orthodox with the rules while others will be more lenient (but consistent), depending on the preferences of the players.
  • Because of the sheer volume of the rules and mechanics, D&D can be overwhelming at first but most people catch on quickly. You don't need to read all of the rules before playing (though skimming some can be helpful) - the DM is expected to help new players get familiar with the rules.
  • Rules are organized i
@jsgoller1
jsgoller1 / 3-5.cpp
Last active February 27, 2019 06:59
Accelerated C++ exercise
/*
3-5. Write a program that will keep track of grades for several students at
once. The program could keep two vectors in sync: The first should hold the
student's names, and the second the final grades that can be computed as input
is read. For now, you should assume a fixed number of homework grades. We'll see
in §4.1.3/56 how to handle a variable number of grades intermixed with student
names.
-------------------------
Again, I think we can just use a map - can we use a mapping of strings to
vectors?
@jsgoller1
jsgoller1 / Makefile
Last active January 8, 2019 23:13
Dockerized Anaconda setup
# Create a file called "Makefile" and copy / paste the contents of this gist into it.
# Then from the same directory, run `make all`. Requires docker-ce and GNU make to be installed.
anaconda all: anaconda-rm anaconda-container anaconda-shell
# Stop and remove the running Anaconda container
anaconda-rm:
-docker stop anaconda
-docker rm anaconda
@jsgoller1
jsgoller1 / matrix_search.py
Created August 14, 2018 08:55
2D matrix search (python3)
"""
https://leetcode.com/problems/search-a-2d-matrix/description/
---
Understand
Program takes a value and a list of lists, should efficiently find whether
the value is in any sublist. Returns bool, not index.
This is a D&C problem - the lists are sorted, and later lists bound earlier lists. We do not
need to examine every item, so we can likely binsearch.
@jsgoller1
jsgoller1 / hr_bfs_solved.py
Created May 10, 2018 06:45
HackerRank - BFS: Shortest Reach in a Graph
# https://www.hackerrank.com/challenges/ctci-bfs-shortest-reach/copy-from/72471548
from collections import deque
class Graph():
def __init__(self, node_count):
self.nodes = {}
for i in range(node_count):
self.nodes[i] = []
@jsgoller1
jsgoller1 / tries_contact.py
Created May 9, 2018 01:24
HackerRank Tries: Contacts
class t_node():
def __init__(self):
self.children = {}
self.is_complete = False
self.valid_children = 0
def add_child(self, char):
self.children[char] = t_node()
return self.children[char]