Skip to content

Instantly share code, notes, and snippets.

@bpetlert
bpetlert / usb-net-restart
Created September 25, 2022 07:53
Restart USB 3.0 to ethernet adapter (ASIX Electronics Corp. AX88179 Gigabit Ethernet)
#!/usr/bin/env bash
#
# Restart USB 3.0 to ethernet adapter (ASIX Electronics Corp. AX88179 Gigabit Ethernet)
#
# The device will stop functioning with this error message below:
#
# [ 1179.475926] kernel: xhci_hcd 0000:04:00.0: WARN: TRB error for slot 1 ep 5 on endpoint
# [ 1179.607026] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
# [ 1179.607049] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
@bpetlert
bpetlert / wan-uptime
Created March 19, 2022 21:27
Get WAN uptime on OpenWrt
#!/bin/sh
ubus call network.interface.wan status | grep uptime | sed 's/[^0-9]//g'
@bpetlert
bpetlert / fetchjsonp.js
Created March 14, 2019 02:38
Fetch JSONP using vanilla javascript
/**
* source: [Create GUID / UUID in JavaScript?, broofa]{@link https://stackoverflow.com/a/2117523}
*/
export function uuidv4() {
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
(
c ^
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
).toString(16),
);