Skip to content

Instantly share code, notes, and snippets.

@movalex
movalex / get_latest_gitlab_release.sh
Last active July 21, 2023 12:17
Get latest GitLab release
apk add --no-cache curl jq
PROJECT_ID=47716115
curl https://gitlab.com/api/v4/projects/$PROJECT_ID/releases/ | jq '.[]' | jq -r '.tag_name' | head -1
@movalex
movalex / rename_using_tags.py
Last active August 3, 2023 14:41
Rename files based on Windows file tag
from pathlib import Path
import os
import shutil
from win32com.propsys import propsys
FOLDER = Path(".")
OUTPUT = "TEL"
pk = propsys.PSGetPropertyKeyFromName("System.Keywords")
@movalex
movalex / compare_select_unique.py
Last active August 1, 2023 10:59
Compare two files and create file with unique lines
def find_unique(a, b):
return [item for item in b if item not in a]
a = open("file1.txt", "rb").readlines()
b = open("file2.txt", "rb").readlines()
with open("out.txt", "wb") as f:
unique_lines = find_unique(a, b)
for line in unique_lines:
@movalex
movalex / ffmpeg_cut_video_in_chunks.py
Created August 3, 2023 15:49
FFmpeg cut video in chunks
import sys
import os
from pathlib import Path
CHUNK_LENGTH = 59
def cut_chunks(file_name=None, resize=False):
if not file_name:
print("enter file name")
@movalex
movalex / 01. remove_zero_sized_onedrive_items.ps1
Last active August 29, 2023 10:00
Remove unsynced OneDrive files with Zero Disk Size
$files = Get-ChildItem -Recurse "*.*"
foreach ($f in $files) {
If ($f.attributes -eq 4199968) {
$outfile = $f.FullName
$attrs = $f.attributes
Write-Output "file: $outFile`nlen: $((Get-Item $f).length)`nattrs: $attrs"
Remove-Item $f
echo $outfile >> files.txt
}
@movalex
movalex / ydl_40sec.sh
Created October 9, 2023 11:57
download first n seconds from youtube video
yt-dlp.exe --downloader ffmpeg --downloader-args "ffmpeg:-t 40"
@movalex
movalex / install_qbittorrent-nox_macos.md
Last active December 10, 2025 07:01
Install qbittorrent-nox on macos 12+

Requirements

  • zlib >= 1.2.11
  • Qt 6.5.0 - 6.5.5
    • Despite building headless application, the QT library should be installed
  • CMake >= 3.16
  • Boost >= 1.76
  • libtorrent-rasterbar >= 1.2.19
  • Python >= 3.7.0
@movalex
movalex / https_server_setup_simple.py
Created December 22, 2023 09:26
Setup simple https server
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
import socketserver
httpd = HTTPServer(('0.0.0.0', 4443), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile=r"C:/Users/username/.certs/key.pem",
certfile=r'C:/Users/username/.certs/cert.pem', server_side=True)
@movalex
movalex / download_cloudapp_data.py
Last active January 3, 2024 21:40
Download CloudApp Data
import argparse
import os
import pandas as pd
import requests
from requests.adapters import HTTPAdapter, Retry
import concurrent.futures
from pathlib import Path
from tqdm import tqdm
from datetime import datetime
@movalex
movalex / ParseDuration.m
Last active January 10, 2024 18:57
Power Query Youtube API parse Songs
// ParseDuration
let
ParseDuration = (duration as text) as nullable time =>
let
minutesText = Text.BetweenDelimiters(duration, "PT", "M"),
secondsText = Text.BetweenDelimiters(duration, "M", "S"),
minutes = if minutesText <> "" then Number.FromText(minutesText) else 0,
seconds = if secondsText <> "" then Number.FromText(secondsText) else 0,
time = #time(0, minutes, seconds)
in