<!--- Provide a general summary of your changes in the Title above -->
<!--- Describe your changes in detail -->
# Usage: python3 tldr_fail_test.py ${HOSTNAME} | |
# | |
# You can optionally pass the destination IP with --addr | |
# | |
# Author: davidben [at] chromium [dot] org | |
import argparse | |
import socket | |
import time |
Button { | |
padding-left: 1; | |
padding-right: 1; | |
} | |
TextInput { | |
layout: horizontal; | |
height: 3; | |
background: $panel-darken-1; | |
border: tall $panel-darken-2; |
[ | |
{ "keys": ["ctrl+shift+l"], "command": "find_all_under" }, | |
{ "keys": ["ctrl+f2"], "command": "find_all_under" }, | |
{ "keys": ["alt+shift+i"], "command": "split_selection_into_lines" }, | |
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" }, | |
{ "keys": ["ctrl+shift+b"], "command": "build" }, | |
{ "keys": ["alt+up"], "command": "swap_line_up" }, | |
{ "keys": ["alt+down"], "command": "swap_line_down" }, | |
{ "keys": ["ctrl+shift+up"], "command": "select_lines", "args": {"forward": false} }, | |
{ "keys": ["ctrl+shift+down"], "command": "select_lines", "args": {"forward": true} }, |
import bisect | |
def bisect_index(arr, start, end, x): | |
i = bisect.bisect_left(arr, x, lo=start, hi=end) | |
if i != end and arr[i] == x: | |
return i | |
return -1 | |
def exponential_search(arr, start, x): | |
if x == arr[start]: |
#Import library | |
import json | |
# This is a python library for 'Text Processing Serveices', as the offcial site suggests. | |
import difflib | |
from difflib import SequenceMatcher | |
#Let's load the same data again | |
data = json.load(open("dictionary.json")) | |
#Run a Sequence Matcher |
This concept is very much like .jar
or .war
archives in Java.
NOTE: The built
.pyz
zipapp can run on both Python 2 & 3 but you can only build.pyz
zipapps with Python 3.5 or later.
#@yasinkuyu 08/09/2017 | |
def check_internet(): | |
url='http://www.google.com/' | |
timeout=5 | |
try: | |
_ = requests.get(url, timeout=timeout) | |
return True | |
except requests.ConnectionError: | |
print("İnternet bağlantısı yok.") |
<!-- create a folder named templates, put this file into it --> | |
<!DOCTYPE html> | |
<title>Upload File</title> | |
<h1>Photo Upload</h1> | |
<form method="POST" enctype="multipart/form-data"> | |
{{ form.hidden_tag() }} | |
{{ form.photo }} | |
{% for error in form.photo.errors %} | |
<span style="color: red;">{{ error }}</span> | |
{% endfor %} |