This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# f-strings new in 3.6 and 3.7+ | |
# f-string tutorial code for video: https://youtu.be/c46t7eIldaI | |
# multiple columns how do you align decimals (zeros should fill in) | |
# using field width to align columns of numbers | |
values = [1, 3, 5, 7, 10, 21] | |
# table of float(v1/v2) for all combinations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
''' Linear time complete graph check for structural balance checker as per | |
https://www.reddit.com/r/dailyprogrammer/comments/aqwvxo/20190215_challenge_375_hard_graph_of_thrones/ | |
Algorithm. Since it is a complete graph that has every possible edge between nodes. We don't need a graph. | |
As we read edges, store edge in dictionary with key as tuple of the two nodes names, | |
normalized so the first node in the tuple is less than second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inspect import getframeinfo, currentframe | |
import os | |
def line_at(style=None): | |
""" | |
returns string with caller filename function name and line number | |
style parameter (sample string): | |
'long': 'File /Home/user/xyz.py, in foo(), Line 233' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import pygame | |
# initial setups | |
pygame.init() | |
screen_size = 500 | |
surface = pygame.display.set_mode((screen_size, screen_size)) # window size and pixels width/height | |
# animation state variables | |
angle_per_step = .05 # degrees |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See Medium Article to go along with this gist at: https://gerry-jenkins.medium.com/installing-archlinux-in-virtualbox-beats-dual-boot-for-work-eb4c5cf2fed7 or at my site: http://gjenkinsedu.com/post/2021-01-13_installing-linux-in-virtualbox-best-dual-boot-for-real-work/ | |
# ArchForVBFormula, | |
## VirtualBox Setup | |
- Arch Linux 64 bit | |
- Memory: 2G to recommended half of total | |
- Drive: VDI dynamic at least 30G for working system | |
- Processor cores: recommend half of total | |
- Display: max out the amount of display memory |
OlderNewer