Eg: attaching an arduino from host machine to wsl 2 linux machine
-
Download and install usbipd-win
-
Check the list of usb devices, and get the bus id(X-Y):
usbipd list
Eg: attaching an arduino from host machine to wsl 2 linux machine
Download and install usbipd-win
Check the list of usb devices, and get the bus id(X-Y):
usbipd list
| /* | |
| cgbi2png.ts | |
| Convert Apple CgBI PNG ("iPhone-optimized PNG") to standard PNG. | |
| What this does: | |
| - Parses PNG, detects and removes the CgBI chunk (present before IHDR). | |
| - Concatenates IDAT data and inflates using raw DEFLATE (inflateRaw). | |
| - For color type 6 (RGBA, 8-bit): | |
| * Reverse PNG scanline filters to reconstruct pixels | |
| * Convert BGRA -> RGBA |
| from setuptools import setup, find_packages | |
| from Cython.Build import cythonize | |
| import os | |
| import shutil | |
| import glob | |
| # Set build directory for Cython-generated files | |
| build = "build" | |
| src = "src" | |
| package_name = "whl_packaging_demo" # Thay ฤแปi nแบฟu cแบงn |
| from datetime import datetime | |
| from os import system | |
| import requests | |
| import json | |
| import traceback as tb | |
| import re | |
| ## Please install ffmpeg before running this script and make sure it's in your PATH | |
| ## brew install ffmpeg |
| # Format Style Options | |
| --- | |
| BasedOnStyle: WebKit | |
| AllowShortIfStatementsOnASingleLine: WithoutElse | |
| BreakBeforeBinaryOperators: None | |
| BreakBeforeBraces: Attach | |
| ColumnLimit: 250 | |
| ContinuationIndentWidth: 2 | |
| Cpp11BracedListStyle: true | |
| IndentWidth: 4 |
| async function generateOneTimePassword(rawKey: Uint8Array, counter: number): Promise<number> { | |
| const data = new DataView(new ArrayBuffer(8)); | |
| data.setBigUint64(0, BigInt(Math.floor(counter)), false); | |
| const algo = { name: 'HMAC', hash: 'SHA-1' }; | |
| const key = await crypto.subtle.importKey('raw', rawKey, algo, false, ['sign']); | |
| const hmacHash = new Uint8Array(await crypto.subtle.sign(algo, key, data.buffer)); | |
| const offset = hmacHash[hmacHash.byteLength - 1] & 0x0f; | |
| const hotp = (hmacHash[offset] & 0x7f) << 24 |
| # Open the Terminal by pressing Ctrl+Alt+T. | |
| # Type the following command to edit the power management configuration file: | |
| sudo nano /etc/systemd/logind.conf | |
| # Find the following line in the file: | |
| #HandleLidSwitch=suspend | |
| # Uncomment the line by removing the "#" at the beginning of the line and change "suspend" to "ignore": | |
| HandleLidSwitch=ignore |
| import os | |
| import base64 | |
| files_size_under_1MB = { | |
| "file_name_1": "file-1_encoded_base64", | |
| "file_name_1": "file-2_encoded_base64" | |
| } | |
| for keys in files_size_under_1MB: | |
| try: os.remove(keys) # remove the old file | |
| except: pass |
| # fmt_num(1000) | |
| # result: 1M | |
| # type(fmt_num(1000)) | |
| # result: <class 'str'> | |
| def fmt_num(num): | |
| suffixes = ["", "K", "M", "B", "T"] | |
| suffix_index = 0 | |
| while abs(num) >= 1000 and suffix_index < len(suffixes)-1: | |
| suffix_index += 1 # increment the suffix index | |
| num /= 1000.0 # divide by 1000 to get the number in the next magnitude |
| import requests | |
| import base64 | |
| # replace with your personal access token(classic) | |
| github_pat = "ghp_abcdfeghi......" | |
| # encode pat using base64 | |
| encoded = base64.base64encode(github_pat.encode()) | |
| # check the encoded base64 |