This file contains 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
import csv | |
import math | |
import gidgethub.httpx | |
import httpx | |
import trio | |
import asyncclick as click | |
STARGAZAERS = """query StargazersCount($owner: String!, $name: String!, $after: String = null) | |
{ |
This file contains 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
from . import google | |
dispatch = { | |
'google': google.validate | |
}[platform](token) | |
def get_profile_for_token(client_ids, platform, token): | |
if platform == 'google' and platform in client_ids: |
This file contains 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
event is a custom object defined above | |
buttons = re.findall(r"text='([-\w ]*)'", event.stringify(), re.MULTILINE) | |
for number in buttons: | |
if number == " " or number == "View pokemon": | |
continue | |
last_request = functools.partial(event.click, text=number) |
This file contains 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
epoch2stat = { | |
key: val | |
for key, val in iteritems({ | |
k: tuple( | |
(lambda stats: stats)( | |
tuple(imap(itemgetter(1), v)) | |
) | |
) | |
for k, v in groupby(sorted( | |
imap( |
This file contains 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
# coding: utf-8 | |
from datetime import datetime | |
from time import sleep | |
from psycopg2 import connect, OperationalError | |
connected = False | |
while not connected: | |
try: |
This file contains 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
import requests | |
url='http://127.0.0.1:8090/blue' | |
hj=requests.post(url,{ | |
"device":"TemperatureSensor", | |
"value":"20", | |
"timestamp":"25/01/2017 10:10:05" | |
}) |
This file contains 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
# -*- coding: utf-8 -*- | |
# Form implementation generated from reading ui file '/Users/epi/Desktop/ImageBrowser/qtui/redox_ui.ui' | |
# | |
# Created by: PyQt5 UI code generator 5.10.1 | |
# | |
# WARNING! All changes made in this file will be lost! | |
from PyQt5 import QtCore, QtGui, QtWidgets |
This file contains 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
class IdModel: | |
id = db.Column(db.Integer, primary_key=True) | |
class User(IdModel, UserMixin, db.Model): | |
username = db.Column(db.String(64), index=True, unique=True) | |
email = db.Column(db.String(128), index=True, unique=True) | |
password_hash = db.Column(db.String(128)) | |
def __repr__(self): |
This file contains 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
browser.find_element_by_xpath('//article/div[2]/section[2]/div/a').click() | |
try: | |
tmp_list = browser.find_element__by_tag_name('_6e4x5') | |
except NoSuchElementException: | |
tmp_list = browser.find_element_by_class_name('_3gwk6') | |
tmp_list = tmp_list.find_elements_by_tag_name('a') |
This file contains 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 is_isogram(string): | |
string_lower = string.lower() | |
for i in string_lower: | |
if not i.isalpha(): | |
continue | |
for n in range(string_lower.index(i) - 1, | |
string_lower.index(i) - len(string_lower), -1): | |
if string_lower[n] == i: | |
print("\"%s\" is not an isogram.") % (string) | |
return False |
NewerOlder