Skip to content

Commit

Permalink
мелкие доработки
Browse files Browse the repository at this point in the history
  • Loading branch information
iMissile committed Mar 14, 2018
1 parent 8a4c9a7 commit 51a60dd
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 98 deletions.
4 changes: 2 additions & 2 deletions 51 habr/habr.wpu
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
'primary_view_state': {'area': 'wide',
'constraint': None,
'current_pages': [1,
0],
4],
'notebook_display': 'normal',
'notebook_percent': 0.30000000000000004,
'override_title': None,
Expand Down Expand Up @@ -398,7 +398,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
'current-loc': loc('excel_convert.py'),
'editor-state-list': [(loc('excel_convert.py'),
{'attrib-starts': [],
'first-line': 9L,
'first-line': 0L,
'folded-linenos': [],
'sel-line': 20L,
'sel-line-start': 554L,
Expand Down
10 changes: 10 additions & 0 deletions 88 squid/analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
library(tidyverse)
library(magrittr)
library(lubridate)
library(readxl)
library(httr)
#library(webreadr)
library(anytime)
Expand All @@ -18,6 +19,15 @@ windowsFonts(robotoC="Roboto Condensed")
m <- content(httr::GET("http://10.0.0.246/access.log"))
write(m, "./data/acc.log")

stop()
df <- loadSquidLog(m)
skimr::skim(df)
summarytools::descr(df) # òîëüêî ñ ÷èñëàìè
summarytools::dfSummary(df, plain.ascii=TRUE) # äîëãî
# summarytools::dfSummary(df, plain.ascii=FALSE) # íó î÷åíü äîëãî
tableone::CreateTableOne(data=df)


stop()

# m2 <- rawToChar(m, multiple=FALSE)
Expand Down
11 changes: 10 additions & 1 deletion 88 squid/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ server <- function(input, output, session) {
flog.threshold(TRACE)
flog.info(glue("App started in <{Sys.getenv('R_CONFIG_ACTIVE')}> environment"))

# загружаем мапинг ip на устройство
devices_df <- read_excel("./data/ip2name.xlsx") %>%
filter(complete.cases(.)) %>%
verify(has_all_names("IP", "hostname"))

# реактивные переменные -------------------
raw_df <- reactive({
input$process_btn # обновлять будем вручную
Expand Down Expand Up @@ -215,7 +220,11 @@ server <- function(input, output, session) {

# таблица-детализация по URL в разрезе ----------------------------
output$url_host_volume_table <- DT::renderDataTable({
df <- req(url_host_df())
df <- req(url_host_df()) %>%
left_join(devices_df, by=c("host"="IP"))

browser()

# https://rstudio.github.io/DT/functions.html
DT::datatable(df,
class='cell-border stripe',
Expand Down
25 changes: 19 additions & 6 deletions 89 nornik/excel_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,41 @@

# import string, sys, os.path
# import re
import time
import win32com.client
from win32com.client import constants

def main():
xlOpenXMLWorkbookMacroEnabled = 52
# xlOpenXMLWorkbookMacroEnabled = 52

xlApp = win32com.client.Dispatch("Excel.Application")
xlApp.Visible = True
xlApp.AskToUpdateLinks = False
xlApp.EnableEvents = True
# https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-msoffice_custom-mso_2007/open-excel-file-with-vba-with-macros-disabled/615d2426-e59e-42bc-83ae-c82f51bb805f?auth=1
xlApp.EnableEvents = False
xlApp.DisplayAlerts = True
# xlwb = xlApp.Workbooks.Open(r'D:\Temp\1\IT.P-18-99 ÄÐÏ-6.1 (äëÿ èìïîðòà) v3-unprotected.xlsm')
# xlwb = xlApp.Workbooks.Open(r'D:\Temp\1\IT.P-18-99 ÄÐÏ-6.1 (äëÿ èìïîðòà) v3.xlsm')
xlwb = xlApp.Workbooks.Open(r'D:\Temp\1\11.xlsm')
xlwb = xlApp.Workbooks.Open(r'D:\Temp\1\11.xlsx', UpdateLinks=3)
# xlwb.SaveAs("D:\\Temp\\1\\res.xls", FileFormat = 56, ConflictResolution = "xlLocalSessionChanges") # http://www.rondebruin.nl/win/s5/win001.htm
time.sleep(5)
print("Ready to save")
# xlwb.SaveAs("res.xlsm", FileFormat = "xlOpenXMLWorkbookMacroEnabled", ConflictResolution = "xlLocalSessionChanges")
xlwb.SaveAs("res.xlsx", FileFormat = "xlOpenXMLWorkbook", ConflictResolution = "xlLocalSessionChanges")
sheet = xlwb.Worksheets('Ðàáîòû - ÍÍ-ÎÖÎ') #.Select()
print(sheet.Range("C139").Value)

# xlwb.SaveAs("D:\\Temp\\1\\res.xls", FileFormat = 56) # http://www.rondebruin.nl/win/s5/win001.htm
# xlwb.RunAutoMacros("xlAutoClose") # íå çàïóñêàåòñÿ
print(xlwb.ActiveSheet.Name)
xlwb.Worksheets('Äëÿ çàãðóçêè').Activate
xlwb.Worksheets('Äëÿ çàãðóçêè').Activate()
print(xlwb.ActiveSheet.Name)
# xlwb.Save()
xlwb.SaveAs("res.xlsm", FileFormat = "xlOpenXMLWorkbookMacroEnabled", ConflictResolution = "xlLocalSessionChanges")
# xlApp.EnableEvents = True
print("Ready to save")
# xlwb.SaveAs("res.xlsm", FileFormat = "xlOpenXMLWorkbookMacroEnabled", ConflictResolution = "xlLocalSessionChanges")
xlwb.SaveAs("res.xlsx", FileFormat = "xlOpenXMLWorkbook", ConflictResolution = "xlLocalSessionChanges")
# xlwb.SaveAs("res.xlsm")
print("Ready to close")
xlwb.Close(SaveChanges=1)

if __name__ == '__main__':
Expand Down
Loading

0 comments on commit 51a60dd

Please sign in to comment.