Skip to content

Instantly share code, notes, and snippets.

View gerryjenkinslb's full-sized avatar

Gerry Jenkins gerryjenkinslb

  • Retired
  • Long Beach, CA
View GitHub Profile
# 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
@gerryjenkinslb
gerryjenkinslb / game_thorns_checker.py
Created February 25, 2019 22:01
Balanced Structure Graph Test (Game of Thorns)
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
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'
@gerryjenkinslb
gerryjenkinslb / pygame_animate_spinning_line.py
Created July 30, 2020 06:34
Basic Animation Technique in PyGame shown in my video: https://youtu.be/gUa1j7gY0yY
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
@gerryjenkinslb
gerryjenkinslb / gist:71b35b2a36b1045767d2375c816d60d2
Last active March 2, 2021 22:19
Formula for Arch/Xcfe4 install in Virtualbox
# 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