Skip to content

Instantly share code, notes, and snippets.

View TutorialDoctor's full-sized avatar

RaphaelSmith TutorialDoctor

View GitHub Profile
@TutorialDoctor
TutorialDoctor / amazon_job_code.py
Created January 13, 2018 18:50
Amazon Job Application Code
import cmath
#https://www.youtube.com/watch?v=eaYX0Ee0Kcg
#This is my solution to the problem he provided.
points = [(-2,4),(0,-2),(-1,0),(2,5),(-2,-3),(3,2)]
orign = (0,0)
print(points)
def get_distance_between(P1,P2):
distance = cmath.sqrt((P2[1]-P1[1])**2+(P2[0]-P1[0])**2)
return distance
@TutorialDoctor
TutorialDoctor / flattened_array.py
Last active January 13, 2018 03:45
job_application_code
L = [[1,2,[3]],4]
#test_list = [1, 2, 3,[[4]],[[[5]]],[6],[[7]]]
model = 9
empty = []
def get_numbers(mod,L):
global empty
#For each item in the list
for item in L:
#If the type of the model is the same as the item:
@TutorialDoctor
TutorialDoctor / password_generator.py
Created January 10, 2018 22:49
Generated alphanumeric passwords with special characters with this python script
import string
from random import *
characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
password = "".join(choice(characters) for x in range(randint(8, 10)))
#print password
for x in range (151):
i = "".join(choice(characters) for x in range(randint(8, 10)))
with open("passwords.txt","a") as outfile:
outfile.write(i+"\n")
@TutorialDoctor
TutorialDoctor / RubySyntax.rb
Last active February 3, 2021 19:21
Ruby Syntax
# Coding
# https://ruby-doc.org/core-1.9.2/String.html
# http://www.peachpit.com/articles/article.aspx?p=1278994&seqNum=4
def title1(name="")
puts "\n" + name.upcase + ":"
puts "-"*65
end
#Note: '\n' doesn't create a new line. Must use "\n".
@TutorialDoctor
TutorialDoctor / organize_files.py
Last active November 23, 2024 21:36
Automatically organize files and folders on your computer using python.
# Drop this folder in a directory and run it. It will organize all of your files into folder by first letter
# This was inspired by my mom (maybe you can relate?)
# This took much longer than I thought it would to figure this out, but I learned which modules are good for file handling.
# It took about an hour to come up with the base of the program, which organizes files by first letter or number
# I would like it to eventually recursively go into folders getting files and organizing them into folders.
# This was made using a straight ahead approach.
# For beginners, a directory is a folder.
# By the Tutorial Doctor
# Sun Dec 20 23:40:49 EST 2015
#------------------------------------------------------------------------------
@TutorialDoctor
TutorialDoctor / GDscript.gd
Last active October 26, 2015 11:33
Syntax of the Godotscript language
extends Node2D
# Godot Script Syntax
# By the Tutorial Doctor
# Fri Oct 2 23:58:22 EDT 2015
#-----------------------------------------------------------
# VARIABLES | DATA TYPES |
#-----------------------------------------------------------
# String
var name = "Tutorial Dcotor"
# WIP
# By the Tutorial Doctor
# CLASSES
#------------------------------------------------------------
class Element:
count = 0
def __init__(self):
self.tag = 'p'
self.id = "elementID"
self.html = "<%s id=\"%s\"></%s>"%(self.id,self.tag,self.tag)
#-----------------------------
# Godot Code Snippets (2D) |
# By the Tutorial Doctor |
# Fri Sep 18 13:14:07 EDT 2015|
#-----------------------------
# MAKE AN OBJECT FOLLOW THE MOUSE
func followMouse(x):
var mouse_position = get_viewport().get_mouse_pos()
-- LUA SYNTAX (WIP)
-- PRINTING
-- Print a string
print("Hello World")
-- Print multiple strings
print("Hello","World")
-- Join/Concatenate two strings (gives errors if not strings)
@TutorialDoctor
TutorialDoctor / procedural_level_generation.py
Created September 3, 2015 22:23
Using Python to model procedural level generation
# -*- coding: utf -*-
# add to soft dev/examples
# By the Tutorial Doctor
# Sep 2, 2015
# Procedural Level Generation
#--------------------------------------------------
# THE CODE