Skip to main content

Posts

Making vanilla web-fontend (project with lit, web component) secured (discussions with chatGpt)

Query: I wn complete seperate .css/.scss and .html template file for my webcomponent.js like in angular. But with complete security. In lit. Use any js lib like domPurify, etc. But I wan complete safety. How? ChatGPT said: Thought for 16s Totally doable. Here’s a secure Lit setup with fully separate .html + .scss files , sanitized with DOMPurify , and rendered into the Shadow DOM without sacrificing performance. Folder layout src / lib/ safe- html .js components/ app-shell .html app-shell .scss app-shell .js 1) Install deps npm i dompurify npm i -D sass Vite will compile .scss . We’ll import the compiled CSS as text and attach it via adoptedStyleSheets (fast + memory-friendly). 2) app-shell.html (pure template file) Put your Carbon UI Shell markup here (no scripts). Example stub: < cds-header aria-label = "My App" > < cds-header-name prefix = "IBM" >[Platform] </ cds-header-name > < cds-header-glo...

Usb reset in Ubuntu (chatGpt discussions)

Query: a usb not working in my ubuntu laptop for which wired mouse not working in that drive. Any way to reset that usb without restarting ubuntu ChatGPT said: Yes, in Ubuntu you can reset a specific USB port or device without rebooting the entire system using a few different methods. Here's how you can do it safely and quickly. ✅ Step-by-Step USB Port Reset (No Reboot) Option 1: Using usbreset utility This is the cleanest way to reset a USB device without unplugging. Install usbreset (if not available): bash Copy Edit sudo apt install usbutils build-essential wget https://raw.githubusercontent.com/jkulesza/usbreset/master/usbreset.c gcc usbreset.c -o usbreset Find your USB device (e.g., mouse): bash Copy Edit lsusb Example output: arduino Copy Edit Bus 001 Device 005 : ID 046 d:c077 Logitech, Inc. M105 Optical Mouse Get the device file : bash Copy Edit ls -l /dev/bus/usb/001/005 Run usbreset : bash Copy Edit sudo ./usbreset /dev/bus/usb/001/005 Op...