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
<style type="text/css"> | |
@import url(https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/github-gist.min.css); | |
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css); | |
@import url(//fonts.googleapis.com/earlyaccess/cwtexfangsong.css); | |
@import url(//fonts.googleapis.com/earlyaccess/notosanstc.css); | |
.markdown-body blockquote { | |
padding: 0 1em; | |
color: #777; | |
border-left: 0.25em solid #ddd; | |
} |
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 ArtisanalClass(object): | |
def __init__(self, a, b): | |
self.a = a | |
self.b = b | |
def __repr__(self): | |
return "ArtisanalClass(a={}, b={})".format(self.a, self.b) | |
def __eq__(self, other): | |
if other.__class__ is self.__class__: |
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
__all__ = ('Config', ) | |
class Config: | |
def __init__(self, **kwargs): | |
self._options = set() | |
for key, value in kwargs.items(): | |
setattr(self, key, value) | |
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
#!/usr/bin/env python2 | |
"Demonstrate using multiprocessing.Pool()" | |
import multiprocessing, time, logging, os, random, signal, pprint, traceback | |
logging.basicConfig(level=logging.DEBUG) | |
_L = logging.getLogger() | |
class JobTimeoutException(Exception): |
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
# https://stackoverflow.com/a/39225039/5540600 | |
import requests | |
def download_file_from_google_drive(id, destination): | |
def get_confirm_token(response): | |
for key, value in response.cookies.items(): | |
if key.startswith('download_warning'): | |
return value |