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
# Stolen from the docker website | |
FROM ubuntu | |
RUN apt-get update && apt-get install -qq openssh-server python | |
RUN mkdir /var/run/sshd | |
RUN echo 'root:testpass' | chpasswd | |
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | |
ENV NOTVISIBLE "in users profile" |
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
# Create classes based on csv file data | |
with open("file.csv", 'r') as f: | |
header = f.readline().split(',') | |
metaclass = type('csv', (object,), {h:None for h in header}) | |
for line in f.readlines(): | |
m = metaclass() | |
line = line.split(',') | |
for i in range(len(header)): | |
setattr(m, header[i], line[i]) | |
yield m # Return as generator |
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
def get_data(func, message): | |
while True: | |
try: | |
tmp = input(message) | |
tmp = func(tmp) | |
except: | |
print(f"Input not of type: {func.__name__}") | |
else: | |
return tmp |
NewerOlder