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 | |
## Script qualquer | |
echo "Monolito Nimbus - esse código está publicado em GitHubGist" |
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(xts) | |
lugar = 'RiodeJaneiro-RJ' | |
file_in = paste('/path/ObsVar_diario_',lugar,'.csv',sep='') | |
file_out_mensal = paste('/path/ObsVar_mensal_',lugar,'.csv',sep='') | |
file_out_semanal = paste('/path/ObsVar_semanal_',lugar,'.csv',sep='') | |
write_file = function(dados,file_out){ | |
# Arredondar para inteiro | |
coredata(dados) = round(coredata(dados)) |
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 | |
# Script para imprimir os meses dentro de um intervalo | |
data_inicial="2015-10-01" | |
data_final="2017-02-01" | |
ini_sec=$( date -d "$data_inicial" "+%s" ) | |
fim_sec=$( date -d "$data_final" "+%s" ) | |
data_sec=$ini_sec | |
for (( i=0; data_sec < fim_sec; ++i )); do |
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 | |
# Script para imprimir sequência de números infinitamente | |
numero=0 | |
while true; do | |
echo $numero | |
sleep 1 | |
numero=$((numero + 1)) | |
done |
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
# y is a time serie - ts() | |
year_date = window(y, start = c(2017,1), end = c(2017,12)) |
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
# Pacote SQLDF e suas dependencias | |
suppressPackageStartupMessages(require(tcltk,lib=end_libs)) | |
suppressPackageStartupMessages(require(proto,lib=end_libs)) | |
suppressPackageStartupMessages(require(gsubfn,lib=end_libs)) | |
suppressPackageStartupMessages(require(RSQLite,lib=end_libs)) | |
suppressPackageStartupMessages(require(sqldf,lib=end_libs)) | |
# Separate last data part to xreg_fut | |
data_ini = as.character(data$data[1]) | |
data_lim1 = "2017-01-01" |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<wpProQuiz> | |
<header version="0.37" exportVersion="1" /> | |
<data> | |
<quiz> | |
<title titleHidden="false"><![CDATA[Título do questionário]]></title> | |
<text><![CDATA[Breve descrição do questionário]]></text> | |
<category>Bloco 1</category> | |
<resultText gradeEnabled="false"><![CDATA[Comentário no fim dos resultados]]></resultText> | |
<btnRestartQuizHidden>false</btnRestartQuizHidden> |
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
files = list.files(path = 'dados', pattern = '.csv') |
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
date_ini = '2018-05-10' | |
get_week_numbers = function(date_ini){ | |
# Week number of first day from next month (1st week) | |
week_ini = as.integer(format(as.Date(date_ini), '%W')) | |
# Week number of first day from next-next month (4th or 5th week) minus 1 (+2 pra completar 6 semanas) | |
date_end_temp = as.character(as.Date(date_ini) + 31) | |
date_end = paste(strsplit(date_end_temp, '-')[[1]][1], strsplit(date_end_temp, '-')[[1]][2], '01', sep = '-') | |
week_end = as.integer(format(as.Date(date_end), '%W')) - 1 + 2 | |
# Return array with year and week numbers | |
year = format(as.Date(date_ini), '%Y') |
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 | |
# Script to test many IP addresses | |
ips=( '192.168.0.1' '192.168.0.2' '192.168.0.4' '192.168.0.12' '192.168.0.102' ) | |
descr=( 'Host 1' 'Host 2' 'Host 3' 'Host 4' 'Host 5' ) | |
filename='pings_'$(cat /etc/hostname)'.txt' | |
rm -f $filename; touch $filename | |
n=0 | |
for ip in "${ips[@]}"; do |
OlderNewer