# Function decorator that times execution
from time import time
def timer(func):
# Nested wrapper function
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_palindrome(word): | |
""" | |
Check if a word is a palindrome. | |
Args: | |
word (str): The word to check. | |
Returns: | |
bool: True if the word is a palindrome, otherwise False. | |
""" |
On August 15, 2013, Barlow participated in a Reddit AMA, where he shared his "Principles of Adult Behavior",
which were originally written in 1977 on the eve of his 30th birthday and have been in circulation ever since:
-
Be patient. No matter what.
-
Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him in the same language and tone of voice.
-
Never assume the motives of others are, to them, less noble than yours are to you.
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://developer.mozilla.org/en-US/docs/Web/API/Document/designMode | |
document.designmode = "on"; |
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
# pull official python alpine image | |
FROM python:3.7-alpine | |
# Set Environment Variable | |
ENV PYTHONUNBUFFERED 1 | |
ENV C_FORCE_ROOT true | |
# Making source and static directory | |
RUN mkdir /src | |
RUN mkdir /static |
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
# | |
# This small example shows you how to access JS-based requests via Selenium | |
# Like this, one can access raw data for scraping, | |
# for example on many JS-intensive/React-based websites | |
# | |
from time import sleep | |
from selenium import webdriver | |
from selenium.webdriver import DesiredCapabilities |
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
[ | |
{ | |
"id": "1", | |
"title": "Manager de campagne Anvers", | |
"company": "Qiwie", | |
"duration": "7" | |
}, | |
{ | |
"id": "2", | |
"title": "Teamleader of Private Projects Construction", |
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
[ | |
{ | |
"id": "1", | |
"candidates": "2", | |
"views": "1001" | |
}, | |
{ | |
"id": "2", | |
"candidates": "3", | |
"views": "639" |
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
############################## | |
## POSTGRESQL BACKUP CONFIG ## | |
############################## | |
# Optional system user to run backups as. If the user the script is running as doesn't match this | |
# the script terminates. Leave blank to skip check. | |
BACKUP_USER= | |
# Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified. | |
HOSTNAME= |
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 fill_page_with_image(path, canvas): | |
""" | |
Given the path to an image and a reportlab canvas, fill the current page | |
with the image. | |
This function takes into consideration EXIF orientation information (making | |
it compatible with photos taken from iOS devices). | |
This function makes use of ``canvas.setPageRotation()`` and | |
``canvas.setPageSize()`` which will affect subsequent pages, so be sure to |