Accessing console and devtools of extension’s `background` script

You’re looking at the wrong place. These console messages do not appear in the web page, but in the invisible background page (ManifestV2) or service worker (ManifestV3). To view the correct console open devtools for the background script’s context: Visit chrome://extensions/ or right-click the extension icon and select “Manage extensions”. Enable developer mode Click on … Read more

CMD Command to delete files and put them into Recycle Bin?

There is a “recycle.exe” command part of the a collection called cmdutils “Recycle.exe is a safe replacement for the DEL command, that sends files to the recycle bin instead of deleting them. Recycle is also more flexible than DEL; you can specify multiple files at once (or use wildcards)” Available at http://www.maddogsw.com/cmdutils (Tool last updated … Read more

Can I redirect unicode output from the console directly into a file?

When printing to the console, Python looks at sys.stdout.encoding to determine the encoding to use to encode unicode objects before printing. When redirecting output to a file, sys.stdout.encoding is None, so Python2 defaults to the ascii encoding. (In contrast, Python3 defaults to utf-8.) This often leads to an exception when printing unicode. You can avoid … Read more

Provide params hash for put / post requests in rails console

If you want to put or post to a URL there are also methods for that. You can copy/paste the parameters exactly as they are displayed in your Rails production log: app.post(‘/foo’, {“this” => “that”, “items” => [“bar”, “baz”]}) app.put(‘/foo’, {“this” => “that”, “items” => [“bar”, “baz”]}) If you want to sent a custom header, … Read more

Create HTTP post request and receive response using C# console application

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO; namespace WebserverInteractionClassLibrary { public class RequestManager { public string LastResponse { protected set; get; } CookieContainer cookies = new CookieContainer(); internal string GetCookieValue(Uri SiteUri,string name) { Cookie cookie = cookies.GetCookies(SiteUri)[name]; return (cookie == null) ? null : cookie.Value; } public string GetResponseContent(HttpWebResponse response) … Read more

Getting terminal size in c for windows?

This prints the size of the console, not the buffer: #include <windows.h> int main(int argc, char *argv[]) { CONSOLE_SCREEN_BUFFER_INFO csbi; int columns, rows; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); columns = csbi.srWindow.Right – csbi.srWindow.Left + 1; rows = csbi.srWindow.Bottom – csbi.srWindow.Top + 1; printf(“columns: %d\n”, columns); printf(“rows: %d\n”, rows); return 0; } This code works because srWindow “contains the … Read more