Skip to content

Instantly share code, notes, and snippets.

View victorkurauchi's full-sized avatar
🎯
Focusing

Victor Kurauchi victorkurauchi

🎯
Focusing
View GitHub Profile
@victorkurauchi
victorkurauchi / mysql-docker.sh
Created February 28, 2018 20:42 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@victorkurauchi
victorkurauchi / index.js
Created January 23, 2018 23:37 — forked from tmaclean-LV/index.js
Control user access to models in Keystone.js
// Place this with the other middleware inclusion in routes/index.js
keystone.pre('admin', middleware.enforcePermissions);
// removing footer cause is generated by phantomjs
let readyHtml = ''
const initFooter = readyHtml.indexOf('<footer')
const endFooter = readyHtml.indexOf('</footer>')
const tagFooterIndex = initFooter - 1
const tagEndIndex = endFooter + 9
const tagfooter = readyHtml.substring(tagFooterIndex, tagEndIndex)
readyHtml = readyHtml.replace(tagfooter, '')
@victorkurauchi
victorkurauchi / boxplot.R
Last active December 9, 2017 13:34
Estatistica - Conceito Boxplot R language
summary(Valor)
#Min. 1st Qu. Median Mean 3rd Qu. Max.
#50000 95000 120000 144600 182500 362400
#Mínimo = 50000
#Maximo = 362400
#Q1 = 95000
#Q2 = 120000
#Q3 = 182500
# Prova Linguagem Estatistica
# Rodrigo Luis RM32065
# Victor Moriyuki Kurauchi RM37028
# 1) Tire uma tabela de frequência usando a função table na variável Sexo. Quantos
# homens e quantas mulheres têm no arquivo?
attach(Cadastral)
table(Cadastral$Sexo)
attach(Bank)
# regressao linear com salarioi inicial e anos de escolaridade
regressao <- lm(salbeg ~ edlevel)
regressao
anova(regressao)
predito <- fitted(regressao)
predito
Bank$predito <- c(predito)
Bank
#lista 3
#Crie um Data.Frame com as variáveis nome, sobrenome, cpf, idade. Ao menos com 5 linhas.
#Cria uma variável digito_verificador extraindo o nono digito do cpf
#crie uma variávelnome_completo concatenando nome e sobrenome e inclua no data.frame essas duas variáveis.
nomes <- c('victor', 'moriyuki', 'kurauchi', 'joao', 'joana')
sobrenomes <- c('mcgregore', 'oconnel', 'bond', 'junior', 'neto')
cpf <- c(43088711822, 43088711821, 43088711810, 43088711890, 43088711818)
idades <- c(18, 19, 20, 21, 22)
# lista 2
attach(Bank)
#1
barplot(prop.table(table(Bank$sex)) * 100, col=c('pink', 'blue'))
barplot(prop.table(table(Bank$jobcat)) * 100)
barplot(prop.table(table(Bank$sexrace)) * 100, col=c('pink', 'blue', 'green', 'yellow'))
table(Bank$sex)
table(Bank$jobcat)
@victorkurauchi
victorkurauchi / selection.R
Last active October 26, 2017 22:40
3rd class working with R language
attach(Banco_1)
selecao <- Banco_1 [,c('id', 'Situacao')]
selecao
selecao <- Banco_1 [10:20, c('id', 'Situacao')]
selecao
selecao <- Banco_1 [Banco_1$sexo == 'masculino',]
selecao
@victorkurauchi
victorkurauchi / dataframes.R
Last active October 25, 2017 00:50
Working with R and dataframes
nomes <- c('victor', 'moriyuki', 'kurauchi')
salarios <- c(100, 200, 300)
idades <- c(18, 19, 20)
cadastro <- data.frame(nomes, salarios, idades)
cadastro
filhos <- c(0, 2, 4)
cadastro$filhos <-c(filhos)