Skip to content

Instantly share code, notes, and snippets.

View RaulMedeiros's full-sized avatar

Raul Medeiros RaulMedeiros

  • Fortaleza
View GitHub Profile
@RaulMedeiros
RaulMedeiros / gist:f9cdcbfda24022e03c347b49ce04f03d
Last active September 19, 2018 16:58
Load DCM file with pydicom
def load_dcm(img_path):
dcm = pydicom.read_file(img_path)
RescaleIntercept = int(dcm.data_element('RescaleIntercept').value)
return np.array(dcm.pixel_array,dtype=np.int16)+RescaleIntercept
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')
$ 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 \
@RaulMedeiros
RaulMedeiros / database_python_sample
Created October 22, 2018 13:33
database_python_sample
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)
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
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)]
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={
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
@RaulMedeiros
RaulMedeiros / Create Virtual Environments For Python With Conda
Created October 20, 2019 21:56
Create Virtual Environments For Python With Conda
# 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