Skip to content

Instantly share code, notes, and snippets.

View Kamori's full-sized avatar
🌂
woah

Tyler Coil Kamori

🌂
woah
View GitHub Profile
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> myval = "test"
>>> if myval != '':
... print("I got here")
...
I got here
>>> if myval:
... print("I got here part 2")
diff --git a/Dockerfile b/Dockerfile
index 2a5e815..5ae3651 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,9 @@
FROM python:3.7
+COPY . /app
+
WORKDIR /app
@Kamori
Kamori / pony_orm_test.py
Created August 19, 2017 02:45
A ponyorm recursive to_dict example
{1: {'answers': [{'answer': 'here is the answer',
'bestof_question': [],
'created': datetime.datetime(2017, 8, 19, 2, 41, 58),
'id': 1,
'updated': datetime.datetime(2017, 8, 19, 2, 41, 58)}],
'bestanswer': None,
'created': datetime.datetime(2017, 8, 19, 2, 41, 58),
'id': 1,
'statusid': {'Name': 'Example', 'id': 1},
'tags': [],
# Get the keys that don't exist in both dicts
missing = set(val1.keys()).symmetric_difference(set(val2.keys()))
# Get the keys that DO exist in both
found = set(val1.keys()) & set(val2.keys())
diff = len(missing)
matching = len(found)
for resource in missing:
# Lets log the keys that aren't in both dicts and report which one it belonged to
Python 2.7.12 (default, Oct 11 2016, 05:24:00)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> mymessage = "secret message"
>>> while not len(mymessage) % 5 == 0:
... mymessage += 'X'
...
>>> print mymessage
secret messageX
>>> mymessage_iterations = len(mymessage) / 5
madlibs = {'relative': input('Name a relative: '),
'relative2': input('Name antoher relative: '),
'subject': input('Name a college subject: '),
'adjective': input('Name an adjective: '),
'music': input('Type of music: '),
'integer': input('Enter an integer: '),
'float': input('Enter a float: '),
'communication': input('Type of communication: '),
'adjective2': input('Enter another adjective: '),
'food': input('Name a food: ')
# prompt for a name
name = raw_input('Give me a name: ')
# output of name
print name
###
# Print name in a string
#! /usr/bin/env python3
'''pyCookieCheat.py
20140518 v 2.0: Now works with Chrome's new encrypted cookies
Use your browser's cookies to make grabbing data from login-protected sites easier.
Intended for use with Python Requests http://python-requests.org
Accepts a URL from which it tries to extract a domain. If you want to force the domain,
just send it the domain you'd like to use instead.