Skip to content

Instantly share code, notes, and snippets.

import re
import os
import time
import googleapiclient.discovery
from datetime import timedelta
from functools import reduce
API_TEST_CHANNEL = "UC_x5XG1OV2P6uZZ5FSM9Ttw" # Google Developers YouTube channel
MAX_RESULTS = 10
@movalex
movalex / get_files_without_extensions.ps1
Created January 11, 2024 00:52
Powershell get file list without extensions
Get-ChildItem | Select-Object -ExpandProperty Name | ForEach-Object { $_.Substring(0, $_.LastIndexOf(".")) }
@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
@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 / 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 / install_qbittorrent-nox_macos.md
Last active November 20, 2023 22:44
Install qbittorrent-nox on macos 12+

Requirements

  • zlib >= 1.2.11
  • Qt 6.5.0
    • 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 / 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 / 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 / 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 / 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: