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
| #Backups "custom_dir" into git repo with current datetime as a message | |
| today=`date +%Y-%m-%dT%H:%M:%S` | |
| cd ~/custom_dir | |
| git add . | |
| git commit -m "Backup: $today" |
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 digest auth | |
| http_port 3128 | |
| via off | |
| cache deny all | |
| auth_param digest program /usr/lib/squid/digest_file_auth -c /etc/squid/users | |
| auth_param digest children 5 | |
| auth_param digest realm PASS-PLEASE | |
| auth_param basic credentialsttl 1 minute | |
| auth_param basic casesensitive off |
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
| import os | |
| import glob | |
| def modify_file_date(f): | |
| with open(f) as file: | |
| for l in file.readlines(): | |
| if (l[:11] == "created_at:"): | |
| try: | |
| dt = l[11:].replace("\n", "").replace('"', '').replace(' ', '').split(".") | |
| dt = dt[2] + dt[1] + dt[0] + '0000.00' |
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
| import os | |
| import datetime | |
| import shutil | |
| def writer(folder_to_save, date, time, tags = [], note_name = "", note_text = "", attachments = [], resource_folder = "_resources"): | |
| #Forming a dictionary | |
| props = {} | |
| props['folder_to_save'] = folder_to_save | |
| props['date'] = date | |
| props['time'] = time |
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
| #See Dockerfile here: https://github.com/nsuvorov83/docker-yandex.disk | |
| #Setup yandex.disk | |
| docker run -it --rm --name yandex-disk -v yd-config:/root/.config/yandex-disk -v yd-data:/root/Yandex.Disk yandex-disk sh -c "yandex-disk --dir=/root/Yandex.Disk setup" | |
| #Run yandex.disk as a daemon | |
| docker run -d --restart always -v yd-config:/root/.config/yandex-disk -v yd-data:/root/Yandex.Disk yandex-disk sh -c "yandex-disk --dir=/root/Yandex.Disk start && tail -f /dev/null" | |
| #Run Syncthing with the same volume as yandex.disk | |
| docker run -d --name=syncthing --hostname=syncthing -e PUID=1000 -e PGID=1000 -e TZ=Europe/Moscow -p 8384:8384 -p 22000:22000/tcp -p 22000:22000/udp -p 21027:21027/udp -v syncthing-conf:/config -v yd-data:/data1 --restart unless-stopped lscr.io/linuxserver/syncthing:latest |
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
| FROM ubuntu:22.04 | |
| RUN apt-get update \ | |
| # Upgrade | |
| && apt-get upgrade -y \ | |
| && apt-get dist-upgrade -y \ | |
| # Install dependencies | |
| && apt-get install wget -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
| function forEveryCell(sheet, ra, func) { | |
| /* | |
| * Осуществляет вызов func для каждой ячейки диапазона ra на листе sheet | |
| * | |
| * Пример вызова: | |
| * forEveryCell("deals", "G3:G", function (cell) {Logger.log(cell.getValue())}); | |
| * | |
| */ | |
| var range = SpreadsheetApp.getActive().getSheetByName(sheet).getRange(ra); | |
| var rows = range.getNumRows(); |
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
| from openpyxl import load_workbook | |
| import pandas as pd | |
| def load_df_table(filename, worksheet, tablename): | |
| wb = load_workbook(filename) | |
| ws = wb[worksheet] | |
| dfs = {} | |
| for table_name, value in ws.tables.items(): | |
| table = ws[value] |
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
| (ZIPFile) => | |
| let | |
| Header = BinaryFormat.Record([ | |
| MiscHeader = BinaryFormat.Binary(14), | |
| BinarySize = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger32, ByteOrder.LittleEndian), | |
| FileSize = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger32, ByteOrder.LittleEndian), | |
| FileNameLen= BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16, ByteOrder.LittleEndian), | |
| ExtrasLen = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16, ByteOrder.LittleEndian) | |
| ]), | |
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
| let | |
| Source = Table1, | |
| Transformed = Table.TransformColumnNames(Source, each if Text.Contains(_,"Question") then _ else Text.Replace(_, _, "Answer")) | |
| in | |
| Transformed |
NewerOlder