Skip to content

Instantly share code, notes, and snippets.

View jjesusfilho's full-sized avatar
🏠
Working from home

José de Jesus Filho jjesusfilho

🏠
Working from home
View GitHub Profile
@jjesusfilho
jjesusfilho / matar.sh
Created February 15, 2022 07:06
Mata processo e seus filhos com base em parte do nome
#!/usr/bin/env bash
mpid=$1
pgrep -f $mpid | awk 'NR == 1 {print}' | xargs pgrep -P | xargs kill -9
@jjesusfilho
jjesusfilho / nfe_emitente.R
Created January 24, 2022 18:27
Lê informações dos emitente
#' Lê informações do emitente e converte em tibble
#'
#' @param arquivos Vetor de arquivos
#' @param diretorio Informar diretório se não informar arquivos
#'
#' @return tibble
#' @export
#'
nfe_emitente <- function(arquivos = NULL, diretorio = "."){
@jjesusfilho
jjesusfilho / tpu.R
Last active August 26, 2023 23:52
tpus webservice
tpu_ultima_versao <- function(){
url1 <- "https://www.cnj.jus.br/sgt/sgt_ws.php"
corpo <- '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sgt="https://www.cnj.jus.br/sgt/sgt_ws.php">
<soapenv:Header/>
<soapenv:Body>
<sgt:getDataUltimaVersao/>
</soapenv:Body>
@jjesusfilho
jjesusfilho / tipos-de-logradouros.md
Created January 13, 2022 22:21 — forked from tassoevan/tipos-de-logradouros.md
Tipos de logradouro do Brasil.
  • Aeroporto
  • Alameda
  • Área
  • Avenida
  • Campo
  • Chácara
  • Colônia
  • Condomínio
  • Conjunto
  • Distrito
@jjesusfilho
jjesusfilho / gg_funnel.R
Last active January 12, 2022 14:32
Creates a ggplot funnel
#' Creates a ggplot funnel based on a decreasing numeric vector
#'
#' @param x Decreasing numeric vector
#' @param text Text vector to annotate the funnel.
#' @param color Vector of colors
#'
#' @return ggplot funnel object
#' @details This function needs improvement. I made it ad doc.
#' @export
#'
@jjesusfilho
jjesusfilho / apagar_tabelas.sql
Last active December 29, 2021 14:26
Cria script do PostgreSQL/psql para apagar várias tabelas de uma vez.
WITH cte1 AS (
SELECT relname
FROM pg_class AS pc
INNER JOIN pg_namespace AS pn
ON pn.oid = pc.relnamespace
WHERE pn.nspname = 'public' -- indique outro schema eventualmente
AND relkind = 'r'
)
SELECT string_agg('DROP table ' || relname || ' cascade' || ';', E'\n') AS apagar_tabelas FROM cte1; \gset
@jjesusfilho
jjesusfilho / replace_null.R
Created December 24, 2021 10:00
Replaces nulls in a list.
#' Replaces NULLs in a list
#'
#' @param x List of values
#' @param replacement A replacement value
#'
#' @return Same list with NULLs replaced.
#' @export
#'
#' @examples
#' x <- list(y = 2, z = NULL)
@jjesusfilho
jjesusfilho / googlecontacts.R
Created November 21, 2021 23:30
Busca grupos e contatos do Google
listar_grupos <- function(token){
group_fields <- "name,metadata,clientData,groupType"
page_size <- 1000
req <- request_build(path = "/v1/contactGroups",
base_url = "https://people.googleapis.com",
params = list(groupFields= group_fields,
@jjesusfilho
jjesusfilho / hyperlink_excel.R
Last active February 1, 2023 11:49
Cria hiperlink em coluna com url e salva em excel.
@jjesusfilho
jjesusfilho / tjmt_baixar_cjsg.R
Created October 2, 2021 12:55
Baixa jurisprudência do TJMT
tjmt_baixar_cjsg <- function(busca = "", diretorio = "."){
uri <- "https://jurisprudencia-api.tjmt.jus.br/api/Consulta?"
corpo <-
list(
filtro.isBasica = "true",
filtro.indicePagina = "1",
filtro.quantidadePagina = "5",