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 / reset.gs
Last active August 25, 2024 22:07
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
@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 / 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 / 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