Skip to content

Instantly share code, notes, and snippets.

View ThomasChan's full-sized avatar

ThomasChan ThomasChan

View GitHub Profile
@ThomasChan
ThomasChan / moveFiles.ts
Created March 22, 2024 02:37
Batch move files from SD card to OneDrive cloud
/**
* @author ThomasChan
* @usage deno run --allow-read --allow-write --unstable moveFiles.ts
*/
// Define SD card and OneDrive folder absolute path
const sdCardPath = '/Volumes/Untitled/MP_ROOT'; // replace to your sd card full absolute path
const oneDrivePath = '/Users/<yourusername>/OneDrive'; // replace to your OneDrive full absolute path
// Create folder if not exists
@ThomasChan
ThomasChan / reassignee.ts
Created March 22, 2024 02:23
Batch reassignee self-hosted gitlab issues
/**
* @author ThomasChan
* @usage deno run --allow-net reassignee.ts --token=xxx --assignee=AAA --assignTo=BBB
*/
import { Gitlab } from 'https://esm.sh/@gitbeaker/rest?dts';
function parseArgs(args: string[]) {
const params: { [key: string]: string } = {};
args.forEach(arg => {
const [key, value] = arg.split('=');
@ThomasChan
ThomasChan / moveIssues.ts
Created March 22, 2024 02:19
Batch move self-hosted gitlab issues between milestones
/**
* @author ThomasChan
* @usage
deno run --allow-net moveIssues.ts \
--host=https://gitlab.test.org \
--token=xxxx \
--projectId=1 \
--milestoneName="1.1" \
--labelsToMatch="P2" \
--labelsToExclude="customer,enhancement,feature" \
/**
* [synchServerTime 弱心跳渐强同步服务器时间]
* @author ThomasChan
* @param {int} beginTime [当前时间]
* @param {int} endTime [结束时间]
* @param {function} iterator [每次同步完时间要做的事]
* @return
* @usage
* synchServerTime(
* +new Date()