Skip to content

Instantly share code, notes, and snippets.

View beltiras's full-sized avatar

Árni St. Steinunnarson beltiras

  • Leiguskjól
  • Reykjavík, Iceland
View GitHub Profile
@beltiras
beltiras / pypp.py
Last active October 11, 2018 18:18 — forked from gunnarig/pypp.py
def menu_selection():
try:
print("Menu:")
choice = str(input("add(a), remove(r), find(f):" )).lower
except ValueError:
print("please follow the directions above")
return choice
def execute_selection(choice, a_dict):
if choice == "a":
@beltiras
beltiras / faf.py
Last active October 8, 2018 18:37 — forked from gunnarig/faf.py
def get_word_string(user_file):
user_file = open(user_file,"r")
states = []
#wordString = '' # start with an empty string of words
lines = user_file.readlines()
header = lines[0].split(",")
for line in lines[0:]:
items = line.split("\n")
states.append(items)
#print(states)
@beltiras
beltiras / ppp.py
Last active October 8, 2018 15:51 — forked from gunnarig/ppp.py
def get_word_string(user_file):
user_file = open(user_file,"r")
states = {}
#wordString = '' # start with an empty string of words
lines = user_file.readlines()
header = lines[0].split(",")
for line in lines[1:]:
items = line.split(",")
states[items[0]] = dict(zip(header[1:], items[1:])))
@beltiras
beltiras / ppp.py
Last active September 24, 2018 14:44 — forked from gunnarig/ppp.py
from fractions import Fraction
# shares price
def sharesXprice(stock,valiue):
result = stock*valiue
divide = valiue % 1
dollar = int(valiue)
print("{0} shares with market price {1} {2} have valiue ${3}".format(shares,dollar,divide,result))
from fractions import Fraction
def integer(first):
try:
i = int(first)
except:
return False
return True
start = int(input("Input a position between 1 and 10:"))
position = start
if start > 10 or start < 1:
exit()
print("l - for moving left")
print("r - for moving right")
print("Any other letter for quitting")
while True:
move = input("Input your choice:")
if move not in "lr":
#!/bin/bash
if [ "$#" -eq 0 ]
then
ls | sort | run-parts ${BASH_SOURCE[0]}
fi
if [ $1 ! 1 ]
then
from random import shuffle, choice, randint
key = {}
key['a'] = 11.68
key['b'] = 4.43
key['c'] = 5.24
key['d'] = 3.17
key['e'] = 2.80
key['f'] = 4.03
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCV+A4IbJdxJmM9kLPo/RD+5OsU3W+Uapmbb1cZt2EqQY1jWlaCx/dwmHv68lg8IZkr5bUvz0ivPviY5xCvKUI6C44acUkr5rxUlRxIJ/Ig4YO6RCxZwSiW1ohMR7hf1KYqoH6xhbSn8fDhx88R6u0eLquWrGDGGHOX0lJW6AHyu12HVfdEuxLJ+9H3K/1MHQt1bq/UunxfpFDogowvJc6w7qoDy5Vum4qpADrCFpIn1SWqkOYuwBcq8MceNDxjhVyZezJHf9bWGgc8/S7fWtjpybrJw5f8CWlx3zdki5X42YP8tS73KdSEU0K5zLKhD5+HhdzYDuTpJQOKXxGci7a7 [email protected]
import datetime
def percentage_of_first_trump_term_remaining():
return (datetime.datetime.now() - datetime.datetime(year=2017, month=1, day=20))/(datetime.datetime(year=2021, month=1, day=20) - datetime.datetime(year=2017, month=1, day=20))