Skip to content

Instantly share code, notes, and snippets.

View joeperpetua's full-sized avatar
🐨

Joel Perpetua joeperpetua

🐨
View GitHub Profile
@joeperpetua
joeperpetua / vocabExportBusuu.md
Last active March 15, 2024 06:28
Export / Extract Vocabulary from Busuu

Export / Extract Vocabulary from Busuu Website

Steps:

  • Go to Review page: https://www.busuu.com/dashboard#/review
  • Mute the tab or the PC (when obtaining the audio links, they will be played out loud)
  • Open browser console (Ctrl + Shift + J)
  • Copy/Paste and Run the following code in the browser console:
const vocabList = document.querySelectorAll(".vocab-list-row");
let vocabToExport = [];
@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"
@joeperpetua
joeperpetua / hb_dest_fix.sh
Last active October 23, 2023 13:38
This script helps you to change the usbshare destination for all Hyper Backup tasks that share the same current destination. For example, task A and B where made in usbshare1, but then the USB disk is mounted as usbshare2, then running this script will change the destination for task A and B to usbshare2.
#!/bin/sh
HELP='false';
DSM_MAJOR=0;
DSM_MINOR=0;
CONF_PATH='';
while getopts ":ho:n:" flag
do
case "${flag}" in
h) HELP='true';;
@joeperpetua
joeperpetua / hb_auto_resume.sh
Created August 17, 2023 16:46
Auto resume Hyper Backup task
#!/bin/sh
TASK_ID=3;
TASK_STATUS=$(synowebapi --exec api=SYNO.Backup.Task method=status version=1 task_id="$TASK_ID" additional='["last_bkp_result"]' | jq .data.last_bkp_result);
if [[ "$TASK_STATUS" == \"suspend\" ]]; then
echo "[$(date)] Backup is suspended" >> /volume1/hb_auto_resume.log;
echo "[$(date)] Resuming backup..." >> /volume1/hb_auto_resume.log;
synowebapi --exec api=SYNO.Backup.Task method=resume task_id="$TASK_ID" version=1 >> /volume1/hb_auto_resume.log;
else
echo "[$(date)] Backup is not suspended." >> /volume1/hb_auto_resume.log;
@joeperpetua
joeperpetua / synomount.sh
Created February 22, 2023 12:28
Script to mount/unmount Synology encrypted shared folders via CLI using synoshare built-in tool.
#!/usr/bin/sh
HELP='false'
while getopts ":hm:s:" flag
do
case "${flag}" in
h) HELP='true';;
m) METHOD=${OPTARG};;
s) SHARED_FOLDER=${OPTARG};;
\?) echo "Invalid option: -$OPTARG" >&2; exit 1;;
@joeperpetua
joeperpetua / MyFitnessPal-AVG-Values-Report.js
Created June 25, 2023 17:51
Add button to calculate AVG values for MFP reports for Calories, Net Calories, Protein, Carbs and Fat.
// ==UserScript==
// @name MyFitnessPal - Graph Average values
// @version 0.1
// @description Add button to calculate AVG values for MFP reports for Calories, Net Calories, Protein, Carbs and Fat.
// @author https://github.com/joeperpetua
// @match https://www.myfitnesspal.com/reports
// @icon https://www.google.com/s2/favicons?sz=64&domain=myfitnesspal.com
// @grant none
// ==/UserScript==