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 itertools | |
dict_ = [{'a': [[10.0], ['10', 20], [30.0], ['10', 20, 30.0]], | |
'b': [[10.0], ['10', 20], [30.0], ['10', 20, 30.0]] }]*10 | |
df = pd.DataFrame(dict_) | |
function = lambda x: list(itertools.chain.from_iterable(x['a'])) | |
df['a'] = df.apply(function, axis=1) | |
df |
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
# Create Virtual Environments For Python With Conda | |
## 1. Check conda is installed and in your PATH | |
conda -V | |
## 2. Check conda is up to date | |
conda update conda | |
## 3. Create a virtual environment for your project | |
conda create -n yourenvname python=x.x anaconda | |
## 4. Activate your virtual environment. | |
source activate yourenvname |
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
Constant Value Definition | |
CONTINUE 100 HTTP/1.1, RFC 2616, Section 10.1.1 | |
SWITCHING_PROTOCOLS 101 HTTP/1.1, RFC 2616, Section 10.1.2 | |
PROCESSING 102 WEBDAV, RFC 2518, Section 10.1 | |
OK 200 HTTP/1.1, RFC 2616, Section 10.2.1 | |
CREATED 201 HTTP/1.1, RFC 2616, Section 10.2.2 | |
ACCEPTED 202 HTTP/1.1, RFC 2616, Section 10.2.3 | |
NON_AUTHORITATIVE_INFORMATION 203 HTTP/1.1, RFC 2616, Section 10.2.4 | |
NO_CONTENT 204 HTTP/1.1, RFC 2616, Section 10.2.5 | |
RESET_CONTENT 205 HTTP/1.1, RFC 2616, Section 10.2.6 |
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
from flask import request, jsonify | |
@app.route('/jsonapi') | |
def auth(): | |
json_data = request.get_json() | |
attribute = json_data['attr'] | |
return jsonify(resp=generate_response(attribute)) | |
with app.test_client() as c: | |
rv = c.post('/jsonapi', json={ |
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
pal = [(0.0, 0.5607843137254902, 0.8352941176470589), | |
(0.9882352941176471, 0.30980392156862746, 0.18823529411764706), | |
(0.8980392156862745, 0.6823529411764706, 0.2196078431372549), | |
(0.42745098039215684, 0.5647058823529412, 0.30980392156862746), | |
(0.5450980392156862, 0.5450980392156862, 0.5450980392156862), | |
(0.5058823529411764, 0.058823529411764705, 0.48627450980392156)] |
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
STYLES = [ | |
'seaborn-paper', #1 | |
'dark_background', #2 | |
'seaborn-whitegrid', #3 | |
'_classic_test', #4 | |
'bmh', #5 | |
'seaborn-ticks', #6 | |
'seaborn-poster', #7 | |
'Solarize_Light2', #8 | |
'seaborn-pastel', #9 |
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 psycopg2 | |
def update_DB(host='localhost',dbname='lapisco',user='postgres', | |
password='senha',projetc_id='35',field='status', | |
value='5',table='projeto'): | |
con = None | |
try: | |
con = psycopg2.connect("host='"+host+"' dbname='"+dbname+"' user='"+user+"' password='"+password+"'") | |
cur = con.cursor() | |
cur.execute("UPDATE "+table+" SET "+field+"="+value+" WHERE id="+projetc_id) |
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
Para o stream principal: rtsp://IP:PORTA/user=USUÁRIO&password=SENHA&channel=1&stream=0.sdp? | |
Para o stream extra: rtsp://IP:PORTA/user=USUÁRIO&password=SENHA&channel=1&stream=1.sdp? |
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
$ sudo apt-get update | |
$ sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
$ sudo apt-key fingerprint 0EBFCD88 | |
$ sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
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 argparse | |
def main(args): | |
print(args['asterisk_ip']) | |
return True | |
if __name__ == '__main__': | |
# Asterisk arguments | |
parser = argparse.ArgumentParser(description='LockTech Gate Access Controller 1.0') |