Skip to content

Instantly share code, notes, and snippets.

changbowen /
Created August 17, 2022 13:30
download youtube chaptered videos into separate files, without downloading chapters that already exist based on checking on the names
import os, sys
from pathlib import Path
import yt_dlp
url = sys.argv[1] if len(sys.argv) > 1 else None
download_root = sys.argv[2] if (len(sys.argv) > 2) else None
proxy = sys.argv[3] if (len(sys.argv) > 3) else None
if (None in [url, download_root, proxy]):
raise RuntimeError('Missing arguments.')
changbowen /
Created January 17, 2022 12:38 — forked from braian87b/
Install OpenWRT or LEDE on WD MBL Western Digital MyBookLive
# Instructions to Install OpenWRT or LEDE on WD MBL Western Digital MyBookLive (Tested on Single, but it should work on Duo too)
# Recommended to use a Linux / Debian box with wget, dd, gunzip, lsblk
# Using a Debian box (it could be a VM) with the harddrive connected (it could be a minimal net-install Debian)
See ip with:
ip addr show
# connect remotely using:
user@outside:~/# ssh user@
# We elevate permissions or even better install and config sudo
user@debian8vm:~/# su
changbowen / Start-Monitoring.ps1
Last active September 11, 2021 07:32 — forked from kiwi-cam/Start-Monitoring.ps1
A simple Powershell script that monitors a remote hosts connection. Loops constantly reporting to the screen when the status changes. Optionally also records to the event log, makes an audible beep, and/or sends emails.
View Start-Monitoring.ps1
Tests the connection to the supplied host or IP and reports back on changes to its status.
This script will check the connection to the supplied hostname or IP address every 5 second's to
monitor its status. If the status changes, a message is recorded, the Eventlog is update (optional), and an email is sent
to a supplied email address (optional).
If a TCPPort parameter is suppied the script will attempt to connect to this port. Otherwise a simple ICMP Ping is used.
#!/usr/bin/env python3
import os, sys, time, datetime
import argparse
_parser = argparse.ArgumentParser()
_parser.add_argument('-s', '--servers', nargs='+', help='List of servers to test in the format hostname:port.', required=True)
_parser.add_argument('-a', '--servers-alt', nargs='+', help='Specify alternative address for health check corresponding to each item in servers list. Use same format hostname:port.')
_parser.add_argument('-u', '--url', help='The URL to connect for testing. If this parameter is set, the hostname:port in servers list will be used as socks5 proxies. If not set, a socket connection will be attemped directly to hostname:port.')
_parser.add_argument('-c', '--config-name', help='The name of the shadowsocks-libev server configuration.', required=True)
changbowen / Get-DellWarranty.ps1
Last active September 2, 2021 08:15
Dell API - Get Warranty Info from Service Tag
View Get-DellWarranty.ps1
Function Get-DellWarranty {
[String[]] $ServiceTag,
[string] $APIKey,
[string] $APISecret,
changbowen /
Created December 25, 2020 06:04
Linux Cheatsheet
# Top 20 largest folders under /var (including /var)
sudo du -h /var | sort -rh | head -20
View onedrive get direct download
View NSX-T Group VM Tag Mapping.js
let nsxServer =;
let xsrfToken = await fetch(`https://${nsxServer}/api/v1/reverse-proxy/usersessionInfo`).then(r => r.text()).then(r => JSON.parse(r).xsrfToken);
let pageSize = 500;
// NSX groups with effective VM members
fetch(`https://${nsxServer}/policy/api/v1/search/aggregate?page_size=${pageSize}&cursor=0&sort_by=display_name&sort_ascending=true`, {
"headers": {
"accept": "application/json, text/plain, */*",
"accept-language": "en-US",
"content-type": "application/json;charset=UTF-8",
View referenced_renaming.ps1
function natualSort {
Add-Type -TypeDefinition @'
using System;
using System.Collections;
using System.Collections.Generic;
changbowen / Test-RPC.ps1
Created October 11, 2019 09:05
modified version of the Test-RPC from Ryan Ries
View Test-RPC.ps1
# Author: Ryan Ries [MSFT]
# Origianl date: 15 Feb. 2014
#Requires -Version 3
Function Test-RPC {
[CmdletBinding(SupportsShouldProcess = $True)]
[Parameter(ValueFromPipeline = $True)][String[]]$ComputerName = 'localhost',
[int[]]$Ports = $null