Skip to content

Instantly share code, notes, and snippets.

View StephanieSunshine's full-sized avatar

Stephanie Sunshine StephanieSunshine

  • Prisma Digital Technologies
  • Pacific Northwest, United States
View GitHub Profile
@StephanieSunshine
StephanieSunshine / LICENSE-MIT-MODIFIED.txt
Last active December 26, 2021 06:41
Hangman in Python3
Copyright 2021 Stephanie Sunshine
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, and/or merge copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@StephanieSunshine
StephanieSunshine / roshambo.py
Created December 17, 2021 00:47
Roshambo meets yaml
#!/usr/bin/env python3
from random import sample
import yaml
class Gesture:
# name needs to be unique
def __init__(self, art = "", name = "noname", beats = []):
self.art = art
self.name = name
@StephanieSunshine
StephanieSunshine / roshambo.py
Created December 16, 2021 22:08
Python classes example
#!/usr/bin/env python3
class Gesture:
# initalizer with default values for variables not defined on init
def __init__(self, art = "", name = "noname"):
self.art = art
self.name = name
choices = [
Gesture("@", "Ro"),
@StephanieSunshine
StephanieSunshine / Questions.md
Last active December 8, 2021 02:24
Pop Quiz #2

Great news! You just landed a new job working for BigO Corp as their new hot shot programer. Everyone is expecting great things from you. Your new boss stops by your office and says, "Welcome to the family, fam! We needed a rockstar and they sent us you. The last person never even finished the first task we gave them, said it wasn't worth it or something. Anyways, I forwarded you the email we sent them with all the instructions. This is sort of past due, so if you could get this done asap that would be great. Thanks!"

Hey Rockstar,

Attached is a file full of json blobs that we would like to know more about. Clean this dataset up a bit and write a Python script to break this big file into some smaller files, say maybe sorted by country and a file for blobs that don't have a country? Hey you know while you're at it, it might be nice to go ahead and break it down by asn too, so why don't you do this: make a subfolder for countries and make a subfolder for asns. This way we'll have both sets available to

@StephanieSunshine
StephanieSunshine / insertrust.rs
Created December 7, 2021 13:28
Insertsort in Rust
// input: uint32 list
// output: uint32 list
// implement an insert sort over a list of uint32 in Rust
pub fn sort(l: &mut Vec<u32>) -> &mut Vec<u32> {
// iterate through the list starting on the second one
for i in 1..(*l).len() {
let mut t = i; // we are going to walk with this
let mut try_again = true; // just to init the while loop
while try_again {
try_again = false; // lets not unless something happens
@StephanieSunshine
StephanieSunshine / bubblerust.rs
Created December 7, 2021 12:46
Bubblesort in Rust
// function: is_sorted
// input: uint32 list
// output: boolean
// a list is only sorted if the next neighbor in the list is greater. This is a test for that
fn is_sorted(l: &mut Vec<u32>) -> bool {
// This is called an anonymous dead mans switch it is meant to fail-deadly if there is a failure in logic
// ( our conditional is met ) we start out with high hopes that we will find nothing to trigger
// its failure and return true if we make it all the way through without returning false first
// Because our conditional looks one ahead, we must stop two before the finish line. We use a
// range here instead of a iterator so we can address the vectors elements directly
@StephanieSunshine
StephanieSunshine / main.rs
Created December 7, 2021 11:08
Rust question
Compiling bubblerust v0.1.0 (/home/stephanie/Projects/Rust/bubblerust)
error[E0308]: mismatched types
--> src/main.rs:17:33
|
17 | println!("{:?}", bubblesort(&list));
| ^^^^^ types differ in mutability
|
= note: expected mutable reference `&mut Vec<u32>`
found reference `&Vec<u32>`
@StephanieSunshine
StephanieSunshine / Questions
Last active December 2, 2021 18:49
Pop Quiz #1
These questions are meant to be an evaluation of your skills. I do not want to see what Google thinks is the best solution to these problems, I want to see where your brain is at in your learning
Problem #1
Print a list of 10,000 numbers counting down from 10,000 to 1
Problem #2
Print a dictionary of 10 animals, each entry should have their name, age, and the sound that they make
Problem #3
Read up on big O notation. In one paragraph, explain what Big O notation is and why it is important for a programer to understand. You can use any resource available to you. Talk about it amongst yourselves, Matty would love to tell you all about it.
@StephanieSunshine
StephanieSunshine / pytcpd.py
Created November 21, 2021 15:32
Get client and server ip and port from openbsd-inetd/tcpd
#!/usr/bin/python3
# pytcpd.py
#
# get server ip:port and client ip:port from openbsd-inetd/tcpd
# this can be used as the start of a nowait tcp daemon that needs to be aware
# of the underlying network
#
# Stephanie Sunshine 2021 -- MIT License
@StephanieSunshine
StephanieSunshine / dabQt.py
Last active October 20, 2021 03:13
dabQt -- The perfect timer for taking dabs
#!/usr/bin/env python3
#
# dabQt -- The python 3 / Qt 5 clock for dabbing
#
#
# usage ./dabQt <burn time> <wait time>
#
# space bar to start
# r to reset the timer