Skip to content

Instantly share code, notes, and snippets.

View joeperpetua's full-sized avatar
🐨

Joel Perpetua joeperpetua

🐨
View GitHub Profile
@joeperpetua
joeperpetua / geminiTempDefault.js
Last active February 25, 2026 19:26
This script enables Gemini temporary chat by default on page load
// ==UserScript==
// @name Gemini - Temporary Chat by default
// @namespace https://github.com/joeperpetua
// @version 2026-02-25
// @description Enables Gemini temporary chat by default
// @author joeperpetua
// @match https://gemini.google.com/app
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
@joeperpetua
joeperpetua / settings.json
Created June 24, 2025 09:46
VSCode Tailwind v4 declarations
{
"css.customData": [".vscode/tailwind.json"]
}
@joeperpetua
joeperpetua / export_unsynced_csv.md
Last active August 26, 2025 18:16
Export unsynced files from Synology Drive Client to CSV

You can access the logs directly from the Drive Client DB files.

To do so, first install sqlite3 in your Windows machine:

winget install SQLite.SQLite

Then, run the following command:

Bash CLI:

@joeperpetua
joeperpetua / readme.md
Created June 5, 2024 08:46
Synology Drive Labels

To get a list of the files of home (of user from whom the ssid belongs):
https://IP:5001/webapi/entry.cgi?api=SYNO.SynologyDrive.Files&method=list&version=2&path=/mydrive&_ssid=XXX

If you need a list of the file of a team folder instead, first get the team folders list:
https://IP:5001/webapi/entry.cgi?api=SYNO.SynologyDrive.TeamFolders&method=list&version=1&_ssid=XXX

And then the files of the team folder you want:
https://IP:5001/webapi/entry.cgi?api=SYNO.SynologyDrive.Files&method=list&version=2&path="id:XXX"&_ssid=XXX

@joeperpetua
joeperpetua / readme.md
Created May 15, 2024 14:35
Synology Drive Clear Recycle Bin

We can list shared folders in Drive with their respective ID:

root@NAS-BACKUP:~# synowebapi --exec api=SYNO.SynologyDrive.TeamFolders method=list version=1 | jq '.data.items[] | "ID: \(.file_id) / Name: \(.name)"'
"ID: 795719640889204739 / Name: photo"
"ID: 781590850416189441 / Name: Share update"
"ID: 766719452698944079 / Name: Test Andrea 2"

Then, we can run a recycle bin deletion of only a specified team folder:

@joeperpetua
joeperpetua / drive_rotation_set.sh
Created January 15, 2024 14:34
Change version number in all enabled Synology Drive Team Folders
synowebapi --exec api=SYNO.SynologyDrive.Share method=list version=1 action=list sort_direction=ASC sor_by=share_name | jq '.data.items[] | "\(.share_name) \(.share_enable)"' | grep true | sed 's/ true//g' > /tmp/enabled_shares; cat /tmp/enabled_shares | while read share; do synowebapi --exec api=SYNO.SynologyDrive.Share method=set version=1 share="[{\"share_name\": `echo $share`, \"rotate_cnt\": 5}]" ; done
#!/bin/bash
####
# Usage
# ./increment_subdir_mtime.sh "path/to/parent/folder" increment_in_seconds:INT
# eg:
# ./increment_subdir_mtime.sh "/volume1/DATA/" 5
####
TARGET_PATH=$(realpath "$1")
@joeperpetua
joeperpetua / ABM_export_logs.sh
Created December 13, 2023 10:14
Export Active Backup for Microsoft 365 restore and export logs.
VOLUME='volume1';
SHARED_FOLDER='Data'; # can also specify the subfolder
synowebapi --exec api=SYNO.ActiveBackupOffice365.Portal.Restore.AllLog method=list sort_by=start_time sort_direction=DESC offset=0 version=1 | jq .data > /$VOLUME/$SHARED_FOLDER/ABM_restore_logs.json
synowebapi --exec api=SYNO.ActiveBackupOffice365.Portal.Export.AllLog method=list sort_by=start_time sort_direction=DESC offset=0 version=1 | jq .data > /$VOLUME/$SHARED_FOLDER/ABM_export_logs.json
const sleep = async (time) => {
return new Promise(resolve => setTimeout(resolve, time));
}
(async () => {
let counter = 1;
while (true) {
console.log(`==== Exporting page ${counter} ====`);
await sleep(1000);
console.log(' Getting check...');
#!/bin/sh
TASK_ID=11;
REQ_VERSIONS=10;
SUCC_VERSIONS=0;
# Use a temporary file to store the JSON output
tmpfile=$(mktemp)
synowebapi --exec api=SYNO.ActiveBackup.Task method=list load_verify_status=true load_versions=true filter='{"task_id": '$TASK_ID', "data_formats": [1,4]}' version=1 | jq .data.tasks[0].versions > "$tmpfile"