This file contains hidden or 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
| --- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
| --- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
| -- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
| ------------ | |
| -- Basics -- | |
| ------------ | |
| -- Get indexes of tables |
This file contains hidden or 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
| # | |
| # Copyright 2018 Georgi Tanev (Bulgaria) | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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
| print "Hello Universe" | |
| 3+4 | |
| 3*4 | |
| 2*4+2*3 | |
| 2**3 | |
| 2**0.5 | |
| 3/4 | |
| 3./4. | |
| type(3) | |
| type(3.) |
This file contains hidden or 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
| @author: G | |
| """ | |
| import matplotlib.pyplot as plt | |
| x = [1,2,3] | |
| y = [4,5,6] | |
| plt.plot(x,y) |
This file contains hidden or 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
| ############ Prolet script | |
| #No prottection if URL not working, or in empty reccord. | |
| library(jsonlite) | |
| library(dplyr) | |
| setwd("C:/Users/G/Desktop/prolet") | |
| dir() | |
| #importing list of domains for the loop! | |
| domains_txt <- readLines("domains_weekly.txt") | |
| domains_txt |
This file contains hidden or 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(jsonlite) | |
| library(data.table) | |
| tooldomains <- fromJSON("https://api.majestic.com/api/json?app_api_key=API_key&cmd=GetTopPages&Query=tool.domains&Count=1&datasource=fresh") | |
| names(tooldomains$DataTables$DomainInfo$Data) | |
| test123 <- as.data.table(tooldomains$DataTables$DomainInfo$Data) | |
| #View(test123) |
This file contains hidden or 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
| for(i in seq_along(urls)) { | |
| tmp <- GET(urls[i]) | |
| print(status_code(tmp)) | |
| } |
This file contains hidden or 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(xml2) | |
| library(rvest) | |
| #Importing URL address for the last step putting link in the csv | |
| link1 <- ('http://www.imdb.com/title/tt1490017/') | |
| link1 | |
| lego_movie <- read_html("http://www.imdb.com/title/tt1490017/") | |
| lego_movie | |
| #title |
This file contains hidden or 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
| # console log file | |
| #reading all the files in a directory | |
| #system time is for measuring time | |
| #loading library | |
| # FROM ROW 92 - pure code no console messages | |
| library(data.table) | |
| system.time(files <- list.files(path = "E:/work-TK/extracting_from_file/multiple/all/5", pattern = ".csv")) |
This file contains hidden or 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
| #This is a system time for opening a large file of 100MB+ | |
| #It read it with read.csv for a long time | |
| system.time(file1 <- read.csv("E:/work-TK/extracting_from_file/multiple/file1.csv")) | |
| user system elapsed | |
| 230.27 0.94 257.69 | |
| # The same size of file with fread function (you must install data.table library in R and launch it -> ellapsed time is much less | |
| library(data.table) | |
| system.time(file2 <- fread("E:/work-TK/extracting_from_file/multiple/file2.csv")) |
NewerOlder