Skip to content

Instantly share code, notes, and snippets.

View burak-kara's full-sized avatar
🎯
Focusing

Burak Kara burak-kara

🎯
Focusing
View GitHub Profile
@burak-kara
burak-kara / removeDuplicateFiles.gs
Last active April 2, 2023 16:34
Google Drive - Remove duplicate files (files with the same name) from a folder and its subfolders. Keeps only one copy. Also, deletes a folder if it becomes empty
// Put the ID of the folder you want to process
// https://drive.google.com/drive/folders/abcdefgh
const id = "abcdefgh";
// we will store file names in this dictionary.
// using Set could be more efficient to check if it contains file (time complexity: O(1))
// App Script does not support Set
const allFiles = [];
// Keep deleted file URLs and report in the end
@burak-kara
burak-kara / skip.js
Last active October 10, 2022 11:46
Skip your mandatory -and ofc boring- pdf-based time-sensitive slides in the background.
let isInProgress = true;
const PAGE_DURATION = 90000; // as milliseconds
const BUTTON_TITLE = "Next Page";
const getElement = selector => document.querySelector(selector);
setInterval(() => {
if (isInProgress && getElement(`[title="${BUTTON_TITLE}"]`)) {
isInProgress = false;
setTimeout(() => {
getElement(`[title="${BUTTON_TITLE}"]`).click();
@burak-kara
burak-kara / zipper.py
Created April 13, 2022 08:58
compress, decompress and check MD5 hash of files using gzip in python 3.8+
import gzip
import shutil
import hashlib
import os
original_file = "file/path"
zipped_file = "file/path"
unzipped_file = "file/path"
@burak-kara
burak-kara / dash_segment_downloader.py
Last active April 13, 2022 09:00
Download all possible DASH video and audio segments for different bitrates
import urllib.request
BASE = "https://example.com"
bandwidths = [5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
def download_init(bw):
init = "b-1080-" + str(bw) + "mbps_dash_init.mp4"
url = BASE + init
try:
@burak-kara
burak-kara / reset.gs
Last active June 6, 2024 10:04
Google Drive - Remove Sharing & Access Permissions from folders, subfolders and files. Note that Google Apps Script commands can be changed after this version.
// Note that this script will remove all permissions of all files and subfolders
// (including files in subfolders) of the given folder
// https://drive.google.com/drive/folders/abcdefgh
const id = "abcdefgh";
function start() {
const folder = DriveApp.getFolderById(id);
getSubFolders(folder);
// At the end, reset for parent folder