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 asyncio | |
import pyppeteer | |
import random | |
import time | |
import string | |
import requests | |
import logging | |
from threading import Thread | |
# Import Detection From Stealth |
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
parse_curl_request <- function(){ | |
tot_req <- clipr::read_clip() %>% | |
stringr::str_split("\n") %>% | |
.[[1]] | |
url <- tot_req %>% | |
str_subset("^curl") %>% | |
str_extract("(?<=').*?(?=')") | |
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_proc <- function(){ | |
proc <- system("ps -aux", intern = T) | |
proc[1] %>% str_extract(".{12}") | |
end_first_column <- proc %>% | |
map_dbl(~str_length(str_extract(.x, "[^\\s]+"))) %>% | |
max | |
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
pacman::p_load(tidyverse) | |
source("https://gist.githubusercontent.com/benjaminguinaudeau/2db5647ac4691559ed0f5af6d67166ce/raw/72dd86762962fc6391df3a94c267e7a48ffb5712/get_accessible_videos.R") | |
reconnect <- function(){ | |
file <- "" | |
trig <- try(stop(), silent = T) | |
cli::cli_h1("[ {Sys.time()} ] Reconnecting") |
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
# video_counts <- c("UCtahKSp0CdvDv8CMS7RXsiQ", "UC3XTzVzaHQEd30rQbuvCtTQ", "UC-i2qb4sL10OdR6PyMEU_5Q", | |
# "UCaXkIU1QidjPwiAYu6GcHjg", "UCn8zNIfYAQNdrFRrr8oibKw") %>% | |
# purrr::map_dfr(get_accessible_videos) | |
get_accessible_videos <- function(channel_id){ | |
data <- glue::glue("https://www.youtube.com/channel/{channel_id}/videos") %>% | |
xml2::read_html() %>% | |
rvest::html_nodes("script") %>% |
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
ccs_const_dict <- tibble::tibble( | |
index = c(1, 10, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 11, | |
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 12, 120, 121, | |
122, 123, 124, 125, 126, 127, 128, 129, 13, 130, 131, 132, 133, | |
134, 135, 136, 137, 138, 139, 14, 140, 141, 142, 143, 144, 145, | |
146, 147, 148, 149, 15, 150, 151, 152, 153, 154, 155, 156, 157, | |
158, 159, 16, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, | |
17, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 18, 180, | |
181, 182, 183, 184, 185, 186, 187, 188, 189, 19, 190, 191, 192, | |
193, 194, 195, 196, 197, 198, 199, 2, 20, 200, 201, 202, 203, |
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/env python | |
import smtplib | |
from email.mime.text import MIMEText | |
def send_mail_starttls(sender = '', to = '', pwd = '', subject = '', msg = ''): | |
recipients = [to, sender] | |
msg = MIMEText(msg) | |
msg['Subject'] = subject |
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 asyncio | |
import pyppeteer | |
class poker: | |
def __init__(self, endpoint): | |
self.endpoint = endpoint | |
loop = asyncio.new_event_loop() | |
loop.run_until_complete(self.start()) | |
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
tidy_pglm <- function(fit){ | |
summary(fit)$estimate %>% | |
tibble::as_tibble() %>% | |
dplyr::mutate(param = rownames(summary(fit)$estimate)) %>% | |
dplyr::select(param, dplyr::everything()) %>% | |
janitor::clean_names(.) | |
} | |
predict_glm <- function(fit, new_data, form ){ |
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
try_n <- function(x, n = 2, .otherwise = "", quiet = T){ | |
index <- 1 | |
out <- try(1+a, silent = T) | |
while(index <= n & class(out) == "try-error"){ | |
if(!quiet){message(glue::glue("Trial {index}"))} | |
out <- suppressWarnings(try(x, silent = T)) | |
index <- index + 1 | |
} | |
NewerOlder