View doomsday_clock.R
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(rvest) | |
library(ggplot2) | |
library(stringr) | |
url <- "https://ru.wikipedia.org/wiki/Часы_Судного_дня" | |
df <- url %>% | |
read_html(url) %>% | |
html_node("table") %>% | |
html_table() | |
# Небольшие преобразования: |
View jwst_status.R
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) | |
library(jsonlite) | |
library(png) | |
library(glue) | |
library(ragg) | |
library(here) | |
library(showtext) | |
library(ggdark) | |
library(ggtext) |
View gmail_send_sms
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
gmail.send <- function(username, password, emailto, sub, msg) | |
{ | |
frommailuser <- paste(username,"@gmail.com", sep='') | |
com1 <- paste("sendEmail -f", frommailuser, "-t", emailto, "-o message-charset=utf-8 -u") | |
com2 <- "-m " | |
com3 <- paste("-o message-format=text -s smtp.gmail.com -o tls=yes -xu", username, "-xp", password) | |
system(paste(com1, sub, com2, msg, com3)) | |
} |
View ru_tiled_map.R
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(geofacet) | |
library(ggplot2) | |
mygrid <- data.frame( | |
row = c(1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, | |
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, | |
8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11), | |
col = c(1, 5, 18, 19, 4, 10, 1, 12, 17, 18, 3, 4, 5, 9, 10, 15, 12, 13, 8, 9, | |
10, 17, 18, 20, 1, 3, 14, 15, 16, 4, 5, 6, 7, 12, 13, 7, 8, 9, 10, 17, | |
14, 15, 16, 3, 4, 5, 6, 12, 7, 8, 9, 10, 18, 13, 14, 15, 16, 3, 4, 5, |
View REmoTelegramBot.R
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
#!/usr/bin/Rscript | |
# Пакеты | |
library("httr") | |
library("XML") | |
library("stringr") | |
library("ggplot2") | |
library("telegram") | |
library("RCurl") | |
library("httr") | |
library("Cairo") |
View importKellyGrid.R
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
# Функция-парсер протокола репертуарной решетки из программы | |
# KELLY (В.И. Похилько, Н.Н. Страхов) Автор: Юрий Тукачев | |
# yurij.tukachev@gmail.com | |
importKellyGrid <- function(file, dir = NULL, encode = "UTF-8") { | |
# Необходимые пакеты | |
require(stringr) | |
require(OpenRepGrid) | |
require(tcltk) | |
if (!is.null(dir)) |
View metafor.R
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
p.disagreement <- function(data) { | |
n <- ncol(data) | |
m <- matrix(0, n, n) | |
rownames(m) <- names(data) | |
colnames(m) <- names(data) | |
for (i in 1:n) { | |
for (j in i:n) { | |
m[i, j] <- mean(data[, i] != data[, j]) | |
} | |
} |
View clipboard.R
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
# only works in linux | |
# Install xclip first | |
# $ sudo apt-get install xclip | |
# write to clipboard | |
wclip <- function(x, sep="\t", row.names=FALSE, col.names=TRUE){ | |
con <- pipe("xclip -selection clipboard -i", open="w") | |
write.table(x, con, sep=sep, row.names=row.names, col.names=col.names) | |
close(con) | |
} |
View cowsay.R
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
cowsay <- function(x) { | |
system(paste0("cowsay ", "'", x, "'")) | |
} | |
cowsay("Вечная загадка мира — это его познаваемость. …Сам факт этой познаваемости представляется чудом.") | |
#> cowsay("Вечная загадка мира — это его познаваемость. …Сам факт этой познаваемости представляется чудом.") | |
# _____________________________________ | |
#/ Вечная загадка мира — это его \ |
View pdf2txt.R
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
dest <- "~/pdf" | |
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE) | |
sapply(myfiles, FUN = function(i){ | |
file.rename(from = i, to = paste0(dirname(i), "/", gsub(" ", "", basename(i)))) | |
}) | |
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE) | |
lapply(myfiles, function(i) system(paste('"pdftotext" -layout', paste0('"', i, '"')), wait = FALSE) ) |
NewerOlder