Skip to content

Instantly share code, notes, and snippets.

@liamato
liamato / custom_xhci_hcd
Created December 2, 2021 15:52
Script to suspend the USB adapter on the ZBook 17 G3 when systemd supends the computer avoiding errors like: "pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16" and "dpm_run_callback(): pci_pm_suspend+0x0/0x150 returns -16"
#! /bin/bash
# NAME: custom_xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from systemd automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once
# DATE: Oct 28 2018
# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998
@liamato
liamato / decodeHtmlEntities.js
Created October 29, 2015 22:14
decodeHtmlEntities.js
/**
* Decodes html entities by name and number
*/
var decodeHtmlEntities = function(str) {
return str.replace(/&#?(\w+);/g, function(match, dec) {
if(isNaN(dec)) {
chars = {quot: 34, amp: 38, lt: 60, gt: 62, nbsp: 160, copy: 169, reg: 174, deg: 176, frasl: 47, trade: 8482, euro: 8364, Agrave: 192, Aacute: 193, Acirc: 194, Atilde: 195, Auml: 196, Aring: 197, AElig: 198, Ccedil: 199, Egrave: 200, Eacute: 201, Ecirc: 202, Euml: 203, Igrave: 204, Iacute: 205, Icirc: 206, Iuml: 207, ETH: 208, Ntilde: 209, Ograve: 210, Oacute: 211, Ocirc: 212, Otilde: 213, Ouml: 214, times: 215, Oslash: 216, Ugrave: 217, Uacute: 218, Ucirc: 219, Uuml: 220, Yacute: 221, THORN: 222, szlig: 223, agrave: 224, aacute: 225, acirc: 226, atilde: 227, auml: 228, aring: 229, aelig: 230, ccedil: 231, egrave: 232, eacute: 233, ecirc: 234, euml: 235, igrave: 236, iacute: 237, icirc: 238, iuml: 239, eth: 240, ntilde: 241, ograve: 242, oacute: 243, ocirc: 244, otilde: 245, ouml: 246, divide: 247, oslash: 248, ugrave: 249