Skip to content

Instantly share code, notes, and snippets.

javascript: body.document.requestFullscreen(); undefined
// Bookmarklet, that allows triggering fullscreen mode in mobile browser/website combinations,
// that don't give the option explicitly. Useful when using webapps on mobile,
// e.g. Teams, lesen.amazon.de (read.amazon.com), ...
//
// Useless on desktop browsers, where the F11 key usually triggers full-screen.
//
// Does not work on iOS, because the iOS javascript engines do not implement any fullscreen API.
// Instead, a more limited
! writerec.f90
program main
implicit none
print '(*(1x,G0))', 'x', getX(), 'x', getX()
contains
integer function getX()
getX = 1
print *, '(inside getX)'
end function getX
<html>
<head><title>Hello world.</title></head>
<body><h1>Bye world.</h1></body>
</html>
@kbauer
kbauer / WindowsSpotlightViewImages.bash
Last active June 29, 2018 08:42
A bash script for extracting the full-resolution lock-screen spotlight images on Windows 10. Skips images whose size and layout indicate that they are thumbnails or cropped. Invokes itself recursively in parallel, in order to achieve reasonable performance. Intended for execution with Cygwin's bash shell; Requires ImageMagick.
#!/usr/bin/env bash
# -*- coding: iso-safe-unix -*-
set -e -E -u
#### SETTINGS
SPOTLIGHT_PATH="$(cygpath $LOCALAPPDATA)/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets"
OUTPUT_PATH='/tmp/SPOTLIGHT_DISPLAY'
#### CODE
;;; myelisp-prefix-helper.el --- A hack for namespace insertion -*- lexical-binding: t; coding: utf-8; lisp-indent-offset: nil; -*-
;; Copyright (C) 2018 Klaus-Dieter Bauer
;; Author: Klaus-Dieter Bauer <[email protected]>
;; Keywords: lisp, tools, convenience
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or

Reader Mode.js

Add as bookmarklet (see below):

javascript:/* Reader Mode.js /(function(){ const IFWL=['gfycat.com','disqus.com','www.youtube.com',location.host,];const ifbl=new RegExp('derstandard\.at\/AdServer\/');const startupTasks=[disableViewport,];const periodicTasks=[disableStaticFloaters,removeIframes,];function disableStaticFloaters(){for(let e of document.getElementsByTagName('')){if(window.getComputedStyle(e).position.startsWith('fixed')){e.style.setProperty('position','static','important');}}}function removeIframes(){const iframes=getAllIframesRecursively();for(const e of getAllIframesRecursively().reverse()){try{const doRemove=(!e.src)? false : IFWL.indexOf(new URL(e.src).host)==-1 ? true : e.src.match(ifbl)? true : false;if(doRemove&&e.parentElement){e.parentElement.removeChild(e);}}catch(err){reportError(err,['FAILED TO REMOVE IFRAME',e]);}}window.readerModeRemainingIframes=getAllIframesRecursively();}function disableViewport(){const vp=document.querySelector('meta[name=v

@kbauer
kbauer / myjs-compile-bookmarklet.el
Last active May 5, 2024 21:11
Emacs-lisp command for compiling a javascript file into a bookmarklet, by stripping unnecessary characters and adding a wrapper.
;;; myjs-compile-bookmarklet.el --- strip javascript code as bookmarklet -*- lexical-binding: t; coding: utf-8; lisp-indent-offset: nil; -*-
;; Copyright (C) 2018 Klaus-Dieter Bauer
;; Author: Klaus-Dieter Bauer <[email protected]>
;; Keywords: javascript, bookmarklet
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
javascript:/* MailToSelf */ (function(){target = "mailto:[email protected]?subject=" + encodeURIComponent(document.title) + "&body=" + encodeURIComponent(location.href); location.href = target;})()

On mobile devices, I often use "mail-to-self" type apps to quickly send me a webpage for later reading; Funnelling everything into my mailbox is simply the only way I will actually look at it again. On mobile, these apps integrate with the OS-provided "Share" menus, but on the desktop I had to manually write an email. Hence this bookmarklet, to automate creation of the reminder Email.

Installation

  1. Create a new bookmark.
@kbauer
kbauer / html2bbcode.py
Created November 20, 2017 13:38
A simple python3 script that takes html input and converts it to (an approximation in) BBCODE. Usage described in header comment. Also useful with markdown, preprocessed to html by pandoc. Allows customizing replacement rules for html-tags, which should also allow converting xml documents to some degree.
#!/usr/bin/env python3
#### USAGE
##
## python3 <scriptname> INPUTFILE [ EXTRARULE ... ]
##
## Output is written to stdout.
##
## INPUTFILE must be a html file. Xml should work too, but will like
## require redefining all replacement rules.
@kbauer
kbauer / Adblock Simple.js
Last active June 6, 2024 11:56
A simple adblocker bookmarklet, removing suspicious iframes. To install, copy-paste the source to a bookmark (will automatically remove newline characters). Extend the array ``exceptOrigins`` in order to create new exceptions. Careful: If bookmarklets get too long, they might stop working. This methods provides on-demand adblocking (as opposed t…
javascript:/* Adblock Simple */
(function(){
const exceptOrigins = [
'https://disqus.com',
document.origin
];
function remIF(e){
try{
var orgn = new URL(e.src || 'http://unknown-src').origin;