Skip to content

Instantly share code, notes, and snippets.

View guilhermebferreira's full-sized avatar

Guilherme Ferreira guilhermebferreira

View GitHub Profile
@guilhermebferreira
guilhermebferreira / hl7_debug.py
Created November 17, 2023 18:41
hl7 file message sebug
# from https://stackoverflow.com/a/59624240/1698509
from hl7apy import parser
from hl7apy.core import Group, Component, Field, Message, Segment
class hl7_debug():
indent = " "
indent_seg = " "
indent_fld = " "
def get_pdf_with_js_script(self, src_url):
script = """
var url = arguments[0];
var callback = arguments[arguments.length - 1];
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = \"arraybuffer\";
xhr.onload = function() {
var arrayBuffer = xhr.response;
@guilhermebferreira
guilhermebferreira / install unix2dos and dos2unix on ubuntu
Created February 25, 2022 19:19
using tofrodos to have both unix2dos and dos2unix avaiable on linux
sudo apt install tofrodos
sudo ln -s /usr/bin/fromdos /usr/bin/unix2dos
sudo ln -s /usr/bin/todos /usr/bin/dos2unix
# option a)
__import__("IPython").embed()
# option b)
import ipdb; ipdb.set_trace()
const options = { year: "numeric", month: "long", day: "numeric" };
const date = new Date(2020, 11, 31) // 2020-12-31T03:00:00.000Z
console.log(date.toLocaleDateString("pt-br", options))
// 31 de dezembro de 2020
console.log(date.toLocaleDateString("pt-br", { ...options, month: 'numeric'}))
// 31/12/2020
const regex = /^([0-9]{4})[-](0[1-9]|1[0-2])[-](0[0-9]|1[0-9]|2[0-9]|3[0-1])/gm
const dateRx = new Date(2020, 11, 31) // 2020-12-31T03:00:00.000Z
@guilhermebferreira
guilhermebferreira / selenium_get_element_by_position
Created July 24, 2020 19:00
using selenium, get a element by absolute position
# no matter if the element is inner a iframe, or if you dont find it by id or class
# get the element by absolute position
def get_elment_by_position(x,y):
element = driver.execute_script("""
return document.elementFromPoint(arguments[0], arguments[1]);
""", x, y)
return element
def get_text_editor():
@guilhermebferreira
guilhermebferreira / SonarQube server localhost:9000 can not be reached
Created February 13, 2020 03:12
SonarQube server [http://localhost:9000] can not be reached
root@574da23c398f:~/sonar-test/sonar-scanning-examples-master# sonar-scanner -D sonar.login=598a78d43fe32cd5acbf262871ed516f9e631c44
INFO: Scanner configuration file: /opt/sonarscanner/sonar-scanner-3.2.0.1227-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Linux 4.10.0-38-generic amd64
INFO: User cache: /root/.sonar/cache
ERROR: SonarQube server [http://localhost:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
<?xml version="1.0" encoding="utf-8"?>
<manifest">
<application
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<!--
android:screenOrientation serve para travar a orientação da tela
-->
</application>
@guilhermebferreira
guilhermebferreira / gist:45846a4e68acd3cd7534d08d91111f3e
Created September 16, 2017 17:16
definição de aquote, refecendo "\cite{autor}" como parametro, a alinhando a referencia a direita
%quote com \cite alinhado a direita para o overleaf
\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em
\hbox{}\nobreak\hfil#1%
\parfillskip=0pt \finalhyphendemerits=0 \endgraf}}
\newsavebox\mybox
\newenvironment{aquote}[1]
{\savebox\mybox{#1}\begin{citacao}}
{\signed{\usebox\mybox}\end{citacao}}
@guilhermebferreira
guilhermebferreira / gist:72e2d9a3631097597e13b4e84d4e2c64
Last active January 23, 2020 18:31
Latex, Configurações do pacote backref
\usepackage[brazilian,hyperpageref]{backref} % Paginas com as citações na bibl
% ---
% Configurações do pacote backref
% Usado sem a opção hyperpageref de backref
\renewcommand{\backrefpagesname}{Citado na(s) página(s):~}
% Texto padrão antes do número das páginas
\renewcommand{\backref}{}
% Define os textos da citação
\renewcommand*{\backrefalt}[4]{