Skip to content

Instantly share code, notes, and snippets.

View ebarojas's full-sized avatar
🔭

Everardo J. Barojas M. ebarojas

🔭
View GitHub Profile
@ebarojas
ebarojas / old_postgres_setup
Last active November 11, 2016 22:58
Postgres Setup for Prescrypto installation, this is the old version that was replaced by a script.
# Get Postgres
sudo apt-get update
sudo apt-get install libpq-dev postgresql postgresql-contrib
Add postgres library to PATH (it's a good idea to put it in your .profile )
PATH=$PATH:/usr/lib/postgresql/9.1/bin
export PATH
@ebarojas
ebarojas / auth.py
Last active January 20, 2018 01:37
A simple snippet to authenticate user with API Token
# this will be a view accessed /apiauthview/?token=yourapitoken?redirect_url=/my_redirect_url/
# You need django rest API extended users enabled for this
# For higher security, these tokens should be renewed each time a new request is made
from rest_framework.authentication import TokenAuthentication
# Authenticate a user with API Token
class APITokenAutoLogin(View):
def auth(self, request, *args, **kwargs):
# GET
@ebarojas
ebarojas / ribbon.html
Created January 22, 2018 18:31
Simple ribbon tilted 45 degrees – perfect to announce an ICO *hint hint*
<!-- This is the style -->
<style type="text/css">.ribbon {
background-color: #a00;
overflow: hidden;
white-space: nowrap;
/* top left corner */
position: absolute;
left: -50px;
top: 40px;
/* 45 deg ccw rotation */
@ebarojas
ebarojas / install_latex.sh
Created June 20, 2018 01:32
Install Latex from shell with packages
-#!/bin/sh
-# This is legacy code
-# Latex Install, the prescript way!
-echo "Installing wget"
-sudo apt-get install -y wget
-
-echo "*******************************************"
-echo "Installing Latex 2016 "
-echo "*******************************************"
-cd /vagrant/config
@ebarojas
ebarojas / example.md
Last active January 24, 2020 13:25
Total medic example
{
    // Faltantes Opcionales (Esto es obligatorio si el producto es un Medicamento)
    "description" : "", //  Descripcion adicional del medicamento 
    "measure_units": "" // Son las medidas de los ingredientes, por ejemplo "MCG", "MC", "ML"
    "molecule": "[]" // Ingredientes del producto si es que tiene "['neomicina 250 MG', 'acetilsalicilico 500 mg']" 
    // Faltantes Obligatorio
    "image_url" : "" // Esto debe ser una url único de la imagen, por ejemplo: "https://totalmedic.com.mx/pub/media/catalog/product/cache/image/1000x1320/249a04e11078a485979b671cc312a5a7/m/u/mu_equerasencilladeneopreno-5.jpg",
    // DATA OK - esto no requiere cambios
    "package_desc" : "Muñequera Sencilla de Neopreno", // NOMBRE
@ebarojas
ebarojas / c#.cs
Last active June 16, 2020 23:12
Authorization for Token Auth in C#
using System;
using RestSharp;
public class Program
{
public static void Main()
{
var client = new RestClient("https://integration.prescrypto.com/api/v2/medics/");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
@ebarojas
ebarojas / cheve5.html
Last active August 7, 2020 17:09
Landing page of my first website built with Geocities circa 1996 :/ [From wayback machine]
<html>
<!-- FROM WAYBACK MACHINE -->
<!-- wbinfo.url = "http://www.geocities.com:80/yosemite/gorge/6715/"; -->
<!-- wbinfo.timestamp = "20010825233744"; -->
<!-- wbinfo.request_ts = "20010825233744"; -->
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

Flujo

El flujo es el siguiente

  • el api admin crea un hospital, y guarda el id del hospital creado
  • luego crea al medico asignando en el POST el id del hopsital creado
  • listo, el Medic tiene un Hospital asignado

Paso 1

Generación del Hospital

from Crypto.PublicKey import RSA # nosec B413
from Crypto.Hash import SHA256 # nosec B413
# Read FIEL.cer
def read_fiel_cer(directory_file):
try:
public_key = None
with open(directory_file + '.cer', 'rb') as f:
public_key = RSA.import_key(f.read())
except Exception as e:
@ebarojas
ebarojas / prixz.md
Created May 6, 2024 13:51
Documentación Prixz para Leads

Prixz Leads

Obtener una lista de pacientes que fueron recetados con un medicamento especifico

Es necesario contar conun token con los permisos necesarios.

Se reliza una petición GET de la siguiente manera:

curl --location 'https://www.prescrypto.com/api/v2/prixz/leads/' \