This file contains hidden or 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
t = [ | |
('a', 'b'), | |
('c', 'd') | |
] | |
if len([item[1] for item in t if item[0] == 'a']): | |
print 'yes' | |
else: | |
print 'no' | |
# yes | |
if len([item[1] for item in t if item[0] == 'e']): |
This file contains hidden or 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 prepare_for_api(str_json): | |
""" | |
Prepare a json string API use by escaping double quotes and removing \n new line breaks | |
:param str_json: string | |
:return: string | |
Note: Use pattern is to wrap data at the last possible moment to avoid extra escaping. | |
""" | |
str_json = re.sub(' +', ' ', str_json) # kills multi whitespace | |
str_json = str_json.replace('\n', '') # kill new line breaks caused by triple quoted raw strings | |
str_json = str_json.replace('"', '\\"') # address double quotes |
This file contains hidden or 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
# source http://www.bestwordlist.com/5letterwords.txt | |
WORDS = [ | |
'AAHED', 'AALII', 'AARGH', 'AARTI', 'ABACA', 'ABACI', 'ABACK', 'ABACS', 'ABAFT', 'ABAKA', 'ABAMP', | |
'ABAND', 'ABASE', 'ABASH', 'ABASK', 'ABATE', 'ABAYA', 'ABBAS', 'ABBED', 'ABBES', 'ABBEY', 'ABBOT', | |
'ABCEE', 'ABEAM', 'ABEAR', 'ABELE', 'ABETS', 'ABHOR', 'ABIDE', 'ABIES', 'ABLED', 'ABLER', 'ABLES', | |
'ABLET', 'ABLOW', 'ABMHO', 'ABODE', 'ABOHM', 'ABOIL', 'ABOMA', 'ABOON', 'ABORD', 'ABORE', 'ABORT', | |
'ABOUT', 'ABOVE', 'ABRAM', 'ABRAY', 'ABRIM', 'ABRIN', 'ABRIS', 'ABSEY', 'ABSIT', 'ABUNA', 'ABUNE', | |
'ABUSE', 'ABUTS', 'ABUZZ', 'ABYES', 'ABYSM', 'ABYSS', 'ACAIS', 'ACARI', 'ACCAS', 'ACCOY', 'ACERB', | |
'ACERS', 'ACETA', 'ACHED', 'ACHES', 'ACHOO', 'ACIDS', 'ACIDY', 'ACING', 'ACINI', 'ACKEE', 'ACKER', | |
'ACMES', 'ACMIC', 'ACNED', 'ACNES', 'ACOCK', 'ACOLD', 'ACORN', 'ACRED', 'ACRES', 'ACRID', 'ACTED', |
This file contains hidden or 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
Cobra CM-2204/28 Multirotor Motor, Kv=2300 | |
Cobra C-2202/70 Brushless Motor, Kv=1530 | |
Cobra C-2203/28 Brushless Motor, Kv=2800, E36-F1S | |
Cobra C-2203/34 Brushless Motor, Kv=2300 | |
Cobra C-2203/46 Brushless Motor, Kv=1720 |
This file contains hidden or 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 | |
import time | |
import json | |
token = '' | |
#Delete files older than this: | |
ts_to = int(time.time()) - 30 * 24 * 60 * 60 | |
def list_files(): |
This file contains hidden or 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
<? | |
// Session may not be started on this script, if not init session | |
if (!session_id()) { | |
session_start(); | |
} | |
// double check, once for the key, again that the result is an int larger than 0 (as WP will follow the AI rule in the DB) | |
if (array_key_exists('some_custom_var', $_SESSION) and $_SESSION['some_custom_var'] > 0){ | |
echo 'User is valid with id:'.$_SESSION['some_custom_var']; | |
}else{ |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Authorization</AllowedHeader> | |
<AllowedHeader>Content-*</AllowedHeader> | |
<AllowedHeader>Host</AllowedHeader> | |
</CORSRule> |
OlderNewer