This file contains 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
# get shiny serves plus tidyverse packages image | |
FROM rocker/shiny-verse:latest | |
# system libraries of general use | |
RUN apt-get update && apt-get install -y \ | |
sudo \ | |
pandoc \ | |
pandoc-citeproc \ | |
libcurl4-gnutls-dev \ | |
libcairo2-dev \ |
This file contains 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
# Capture | |
output <- capture.output(q1 %>% show_query()) | |
# Concatenate character vector to a one length character vector | |
final_output <- paste(tail(output, -1), collapse=" ") | |
final_output |
This file contains 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
library(tidyverse) | |
knitr::knit2pdf('path\to\file.Rnw') | |
file_log <- read_file('path\to\file.log') | |
error_text <- | |
file_log %>% | |
stringr::str_split('\n') %>% | |
unlist %>% |
This file contains 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
# Non Parametric Bootstrap Bias Correction and Confidence Interval | |
# Creating the Bootstrap Functions | |
bootstrap <- function(df, sample_prop = 1, B, stat_fun){ | |
"Perfom a bootstrap with B samples applying the stat_fun for | |
calculating the Theta statistic. The prop. of sample you take | |
each Bootstrap step from the data is sample_prop. | |
stat_fun must only take one argument: df. | |
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.io import wavfile | |
samplerate, data = wavfile.read('Data/microphone-results.wav') | |
n = np.arange(len(data)) | |
N = len(n) | |
fhat = np.fft.fft(data, N) | |
PSD = fhat * np.conj(fhat) / N |
This file contains 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
{ | |
"python.pythonPath": "path/to/python", | |
"python.formatting.provider": "autopep8", | |
"python.formatting.blackPath": "venv/bin/black", | |
"python.linting.enabled": true, | |
"python.linting.pylintEnabled": false, | |
"python.linting.flake8Enabled": true, | |
"python.formatting.autopep8Args": [ | |
"--max-line-length", | |
"80", |
This file contains 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
#!/bin/bash | |
file_path=/home/adriel_martins/.update_upgrade.log | |
echo "** TURN ** : $(date +%d-%m-%Y)" >> $file_path | |
apt update >> $file_path | |
apt upgrade -y >> $file_path |
This file contains 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
SELECT *, | |
CASE | |
WHEN e.email like '%_@_%_.__%' | |
AND NOT regexp_like(coalesce(trim(regexp_extract(e.email, '.+?(?=@)')), '$'), | |
'[^a-zA-Z0-9\._-\ã\õ\ẽ\é\ó\ú]') | |
THEN lower(e.email) | |
ELSE 'N/A' | |
END | |
) AS email, | |
CASE |
This file contains 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
def multinomial_goodness_of_fit( | |
f_obs, | |
p_exp=None, | |
b=1000, | |
delta=0 | |
) -> list: | |
""" | |
Calculate the multinomial goodness of fit through Log Likelihood Ratio test statistic with the | |
null distribution calculated via Monte Carlo simulation. |
This file contains 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
# Three main sources for this script: | |
# https://github.com/rocker-org/rocker-versioned2/issues/144 | |
# https://jsta.github.io/r-docker-tutorial/02-Launching-Docker.html | |
# https://stackoverflow.com/questions/65456814/docker-apple-silicon-m1-preview-mysql-no-matching-manifest-for-linux-arm64-v8 | |
# After running the script, access the RStudio on the address http://localhost:8787/ | |
docker run --rm \ | |
--platform linux/x86_64 \ | |
-p 8787:8787 \ |
OlderNewer