In Vimium options only certain characters are allowed for link hints, which seriously limit the number of single character link hints. Allow more characters in the options.
Tuesday, December 17, 2019
Monday, December 9, 2019
XAMPP suddenly stops working, cannot connect
If there is no apparaent reason, no other program runs on the same port, there are no errors in the error log, XAMPP starts properly, etc. then try restarting your router if you have one. Sometimes my router gets confused or something and stops routing localhost traffic for some reason.
Sunday, December 8, 2019
VLC convert/save brightened/gamma corrected video
When doing the conversion, create a new conversion profile in the conversion dialog, enable video filters and there “image properties filter”, so the changed brightness value takes effect in the saved video.
Thursday, November 28, 2019
Emacs pretty print json in buffer
Just call M-x json-pretty-print-buffer
Thursday, November 7, 2019
Fix for google play updates stuck in download pending
Try closing the google play app and starting it again. Clearing its cache can help too.
Thursday, October 24, 2019
java convert exception stack trace to string
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
sw.toString();
Sunday, October 20, 2019
Signed android app install fails with: The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES
do the install with adb from the command line, not from android studio
Wednesday, October 2, 2019
solution for android sharedpreferences is not updated when using stringset data
Just read the docs. The StringSet returned from prefs should not be modified. Make a copy.
Sunday, September 8, 2019
Fix PHP completion in Visual Studio Code
Disable the built in PHP completion extension and install PHP Intelephense.
Sunday, August 25, 2019
kill windows process by name
taskkill /im chosenproc.exe /f
Why it is easier to write a plugin for Emacs than VScode
As a long time emacs user I’m comfortable with Emacs, but I heard so much about VSCode that I gave it a try.
It’s certainly nice, many things work out of the box, the command palette is a nice touch (though a far cry from using Emacs with Helm) and the fact that most thing is accessible via the keyboard makes it a viable alternative.
So it’s like Emacs for the modern ages. Accessible, programmable. I can see myself using it for something in case it provides better support for some langugage than Emacs, though I still prefer Emacs, especially if LSP gives it equal footing in the future in terms of language support.
I tried to create a simple extension too and it was not too hard, but it required trial and errors and reading other extensions’s codes, because the documentation is pretty sparse.
The main takeaway about extensions for me is that VSCode provides an API which you have to use and it’s adequate if it provides the necessary access, but also limiting, because you can’t do things for which the vscode devs haven’t added support yet.
Also, the process of writing an extension is much more convoluted. You have to create an extension template with an npm command which fetches lots of packages into node_modules. Then you code the extension in vscode and trying it involves firing up an other vscode instance. There were mysterious errors when the extension did not work, but there were no error messages anywhere in the debug panel (turns out a node module I tried to use was not installed, but it was never reported to me, I only saw the error: the extension failed to start or something.)
Compared to this in emacs you simply evaluate some code in a buffer and it instantly becomes part of the editor. You are not limited by an API, because you can access the whole editor system. You can override core functions, etc. Of course, the greater power comes with greater responsibilities: you can break the editor if you reach too deep and not careful enough.
Conclusion: VScode is really nice, I like it, but I stil prefer emacs, because it makes it so easy to write extensions, you don’t even have to think about it. A small piece of code would be handy for a quick task? You just write it and it’s part of the editor. No registering an extension, no attaching to specific contribution points, no providers, etc. You just access what you need.
Thursday, August 22, 2019
elisp get time in seconds since the epoch
(string-to-number (format-time-string “%s” (current-time)))
Sunday, August 18, 2019
firefox increase menu font size, bigger font
- In a new tab, type or paste about:config in the address bar and press Enter. Click the button accepting the risk.
- In the filter box, type or paste devp and pause while the list is filtered
- Double-click layout.css.devPixelsPerPx and change its value to 1.5 and click OK. That corresponds to 150% of the classic font size.
Too small? Try 2.0
Don’t choose a value below 1.0 or about 4.0 or you may find it difficult to get back to a viewable Firefox! If something does go terribly wrong, right-click the preference and then tap the R key to reset to the starting value.
https://support.mozilla.org/en-US/questions/1239467
Thursday, August 1, 2019
ripgrep ignore files with glob
The iglob parameter overrides all the ignore files, so you have to repeat every ignore if you use iglob on the command line to ignore things:
rg --files --iglob !logs/ --iglob !cache/ --iglob !images/ --iglob !obsolete/ --iglob "!*log" --iglob "!*.orig" --iglob "!*~" --iglob "!*min.js"
Saturday, July 27, 2019
37 min cardio, AB AB format
Pleasant simple cardio exercises.
Tuesday, July 16, 2019
directory is in windows path, but program is not found from console
Check if the path variable contains quotes ("). There should be no quotes in the value of PATH.
Monday, July 15, 2019
emacs vc-dir hide unregistered files
(add-hook 'vc-dir-mode-hook 'my-vc-dir-mode-hook)
(defun my-vc-dir-mode-hook ()
(local-set-key (kbd "d") 'vc-diff)
(local-set-key (kbd "0") (lambda ()
(interactive)
(vc-dir-hide-state 'unregistered))))
Friday, July 12, 2019
fix character encoding for utf-8 (elisp)
(let ((chars '(("ú" . "ú")
("á" . "á")
("Ã" . "Ã")
("ó" . "ó")
("é" . "é"))))
(dolist (char chars)
(save-excursion
(goto-char (point-min))
(while (search-forward (car char) nil t)
(replace-match (cdr char) t)))))
Thursday, July 11, 2019
Fix for old android cannot connect to some https sites (no secure connection)
Download opera mini and use that. It uses its own network, so it can connect to those sites.
install app to old android without google play
Look up the relevant apk version on apkmirror, download it and tap on it on the phone. Previously you need to enable installing apps from unknown sources in settings.
Wednesday, July 10, 2019
Fix for slow Emacs I/O on Windows
Thursday, July 4, 2019
javascript render html to text with jquery
// create an element where the html content as the string
$('<div/>', {
html: htmltext
// get text content from element for decoded text
}).text()
Thursday, June 27, 2019
android upload photo to google drive does nothing
Upgrade google drive to the latest version if it is older
emacs elisp remove duplicate lines
M-x delete-duplicate-lines
Monday, June 24, 2019
jquery attribute contains string selector
$('a[href*="string"]')
Sunday, June 23, 2019
windows python sudden IOError: [Errno 13] Permission denied
If things worked before and you have proper rights to write the file/directory then check if the filename is a valid name for a file. An invalid file name can also cause this error.
Sunday, June 9, 2019
Emacs display monospace fonts in buffer
Found code. Doesn't really filter monospace fonts:
(defun font-is-mono-p (font-family)
;; with-selected-window
(let ((wind (selected-window))
m-width l-width)
(with-current-buffer "*Monospace Fonts*"
(set-window-buffer (selected-window) (current-buffer))
(text-scale-set 4)
(insert (propertize "l l l l l" 'face `((:family ,font-family))))
(goto-char (line-end-position))
(setq l-width (car (posn-x-y (posn-at-point))))
(newline)
(forward-line)
(insert (propertize "m m m m m" 'face `((:family ,font-family) italic)))
(goto-char (line-end-position))
(setq m-width (car (posn-x-y (posn-at-point))))
(eq l-width m-width))))
(defun compare-monospace-fonts ()
"Display a list of all monospace font faces."
(interactive)
(pop-to-buffer "*Monospace Fonts*")
(erase-buffer)
(dolist (font-family (font-family-list))
(when (font-is-mono-p font-family)
(let ((str font-family))
(newline)
(insert
(propertize (concat "The quick brown fox jumps over the lazy dog 1 l; 0 O o ("
font-family ")\n") 'face `((:family ,font-family)))
(propertize (concat "The quick brown fox jumps over the lazy dog 1 l; 0 O o ("
font-family ")\n") 'face `((:family ,font-family) italic)))))))
source: https://gist.github.com/haxney/3055728
emacs grep on windows (with helm too)
(grep-apply-setting 'grep-command "c:\\\"Program Files\"\\Git\\usr\\bin\\grep.exe -n -i ")
(setq helm-grep-default-command (concat "c:\\\"Program Files\"\\Git\\usr\\bin\\" helm-grep-default-command))
Wednesday, June 5, 2019
mysql command line query show result status
Add -vv
option to the command line
Monday, May 27, 2019
decode encoded characters javascript
function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html;
return txt.value;
}
javascript strip html from text
Saturday, May 18, 2019
Friday, May 17, 2019
windows last boot time, reboot, shutdown, restart
systeminfo | find "System Boot Time"
wmic os get lastbootuptime
Tuesday, May 14, 2019
json pretty print with browser
json read object to association list elisp
(let ((json-key-type 'string))
(json-read-object)))
Using OAuth for a simple command line script to access Google's api
Add blogger post from command line with python
https://developers.google.com/identity/protocols/OAuth2InstalledApp
create OAuth client ID, for consent screen add just a title, then create an Other type key and copy its client id and secret
install the python client library:
https://developers.google.com/api-client-library/python/apis/blogger/v3
use the sample to test the api with your credentials:
https://github.com/googleapis/google-api-python-client/tree/master/samples/blogger
the first time calling the sample you are presented with your consent screen for approval, give approval and from then on you can use the python api to perform operations:
https://developers.google.com/resources/api-libraries/documentation/blogger/v3/python/latest/
Thursday, May 9, 2019
ublock filter specific url only
||www.reddit.com/r/politics/^$document
emacs lisp count unique lines in region, sort results by count, elisp
(let (items)
(dolist (item (split-string (buffer-substring (region-beginning) (region-end)) "\n"))
(let ((match (assoc item items)))
(if match
(setcdr match (1+ (cdr match)))
(push (cons item 1) items))))
(pp (sort items (lambda (x y) (< (cdr x) (cdr y))))))
Friday, April 26, 2019
emacs lisp count unique items in list (elisp)
(let (items)
(dolist (item (list ... put some list of items here ...))
(let ((match (assoc item items)))
(if match
(setcdr match (1+ (cdr match)))
(push (cons item 1) items))))
(print items))
Friday, April 12, 2019
Vivaldi tab bar disappears by itself
In preferences you can assign a hotkey to showing the tab bar (e.g. Ctrl+Shift+A) in the view section of the hotkeys, so the disappearing tab bar can be restored with a hotkey.
Monday, February 11, 2019
Google ads don't appear: adsbygoogle.push() error: No slot size for availableWidth=0
Check if there is a responsive ad unit (e.g. with data-ad-format="auto") and media queries at the same time. The ad should either be responsive or you give the size. The two can't be mixed and it results in the above error.
Wednesday, January 30, 2019
VLC always crashes when started
This deletes the previous configuration settings which can have leftover settings which the new VLC cannot handle.
Saturday, January 19, 2019
How to disable automatic spell checking in Skype
there is a workaround for any Windows. Go to:%userprofile%\appdata\roaming\microsoft\skype for desktop\dictionariesExit Skype, delete "en-US.bdic" (or whatever the name of the one you see there is), and then create a new dummy file by that name (you can right-click in Explorer, select New, and then choose Text Document--but be sure to rename it to the exact name, including extension).Now right-click it, Properties, Security, Advanced. Disable Inheritance/Remove all inherited permissions from this object. Apply. Then OK out.Now start Skype again and it will not be able to recreate the real dictionary file, as it otherwise would have done, and there will be no spellchecking.All of the above, may need to be redone each time Skype upgrades.
Wednesday, January 9, 2019
Deleting undeletable Android apps without rooting the phone
Tuesday, January 1, 2019
Wireless mouse suddenly starts moving on its own
But anytime I used the mouse the cursor started moving left on its own. Very annoying. After digging a bit and trying solutions which recommended upgrading driver software and such which did not help, an article mentioned interference.
And lo and behold, some cables got twisted, got near the usb receiver and when I straightened them and moved them away from the usb receiver of the mouse, the problem went away.
So look out for interference from some cables if you use a wireless mouse and/or keyboard.