Skip to content

Instantly share code, notes, and snippets.

View oliveratgithub's full-sized avatar

Oliver oliveratgithub

View GitHub Profile
@oliveratgithub
oliveratgithub / html_element_overflow_debug_bookmarklet.js
Created June 29, 2022 15:14
🪟 HTML element size overflow debugging: browser bookmarklet to add colorful borders around all DOM elements on a page using CSS.
javascript:document.querySelectorAll(%22*%22).forEach(function(a)%7Ba.style.outline%3D%221px%20solid%20%23%22%2B(~~(Math.random()*(1%3C%3C%2024))).toString(16)%7D)
@oliveratgithub
oliveratgithub / html_form_field_values_bookmarklet.js
Created June 29, 2022 14:39
📋 Store and refill HTML web form field values: a dynamic browser bookmarklet to re-fill a form with pre-defined values in 1-click. Great help for repeated testing of web forms.
javascript:(function()%7Bfunction%20copyToClipboard%20(text)%20%7B%20window.prompt%20(%22Copy%20to%20clipboard%20Using%20Ctrl+C%20and%20then%20paste%20into%20destination%20bookmarklet%22,%20text);%20%7D%20function%20addToForms(i,form)%20%7Bvar%20str%20=%20'';%20var%20obj%20=%20document.forms%5Bi%5D.querySelectorAll(%5B'textarea',%20'select',%20'input'%5D);%20for%20(var%20j=0;%20j%3Cobj.length;%20j++)%20%7B%20if%20(obj%5Bj%5D.type%20==%22checkbox%22%7C%7Cobj%5Bj%5D.type%20==%22radio%22)%20%7Bstr%20+=%20%22setVal(%22%20+%20i%20+%20%22,f,'%22%20+%20obj%5Bj%5D.name%20+%20%22',%22%20+%20obj%5Bj%5D.checked%20+%20%22);%22;%7D%20else%20%7B%20str%20+=%20%22setVal(%22%20+%20i%20+%20%22,f,'%22%20+%20obj%5Bj%5D.name%20+%20%22','%22%20+%20escape(obj%5Bj%5D.value)%20+%20%22');%22;%7D%7D%20return%20str;%7Dvar%20forms%20=%20document.forms;%20var%20str%20=%20%22%22;%20var%20f%20=%20new%20Array();for%20(var%20i=0;i%3Cforms.length;i++)%7Bf.push('%22'%20+%20forms%5Bi%5D.name%20+%20'%22'%20);%20str%20+=%20addToForms(i,forms%5Bi%5
@oliveratgithub
oliveratgithub / contenteditable_on.js
Last active May 20, 2022 14:27
📝 On-page Website Content Editing: contentEditable browser bookmarklets to start/stop live-edit mode
javascript:document.body.contentEditable=true;
@oliveratgithub
oliveratgithub / decode_outlook_safelinks_browserbookmarklet.js
Created May 20, 2022 13:57
Decode outlook.com safelinks protection URLs using a Webbrowser bookmarklet
@oliveratgithub
oliveratgithub / howto.md
Last active May 20, 2022 13:53
Sauna Stats Grabber: Sauna - Seebad Enge (https://www.seebadenge.ch/wp/sauna)

Sauna Stats Grabber

Sauna - Seebad Enge

Pre-requisites

Python version

python3

Python dependencies

sudo apt-get install python3-bs4 or…

@oliveratgithub
oliveratgithub / autoexec.cfg
Last active September 11, 2021 09:23
ioQuake3 – custom high definition configurations for best visual quality (Quake 3, Quake III Arena). This config file is featured on https://swissmacuser.ch/how-you-want-to-run-quake-iii-arena-in-2018-with-high-definition-graphics-120-fps-on-5k-resolution/
seta r_mode "-1"
seta r_customwidth "5120"
seta r_customheight "2880"
seta cg_fov "115"
seta cg_gunCorrectFOV "1"
seta cl_renderer "opengl2"
seta r_allowSoftwareGL "0"
seta r_ignoreGLErrors "1"
seta r_smp "1"
seta r_displayrefresh "0"
@oliveratgithub
oliveratgithub / .htaccess
Created August 8, 2021 18:11
A very simple .htaccess pretty URL rewrite for Apache2 HTTP Server
RewriteEngine On
RewriteRule ^([\w-]+)(?:\.html|/)?$ $1.html [NC,QSA,L]
# Makes something like "website.com/abc123" => work by delivering the file "/abc123.html"
@oliveratgithub
oliveratgithub / ddns_updater.sh
Created November 5, 2015 14:28
Automatic Dynamics DNS updater using HTTP API calls, prepared for TwoDNS.de / Two-DNS.de (works with any other DDNS Service, allowing IP updates via HTTP API calls)
#!/bin/sh
log="ddns_updater.log.txt"
my_ext_ip=$(curl -sS http://icanhazip.com)
echo "\n\n\n===== \
\n$(date -u) \
\nUpdating IP to: $my_ext_ip \n" >> $log
curl -isSX PUT \
-u "mail@host.tld:api_token" \
-H "Content-Type: application/json" \
--data '{"ip_address":"'$my_ext_ip'", "activate_wildcard": "false"}' \
@oliveratgithub
oliveratgithub / seo_meta.php
Last active May 10, 2021 20:57
PHP Regex to output SEO optimized «meta title» and «meta description» with valid characters only and utf8 support
<?php
/** Raw content input */
$title = 'Begriff "Test"; zu weiteren gleichnamigen Bedeutungen siehe Test <Begriffsklärung>';
$description = 'Das Wort „Test“ kommt vom altfranzösischen test: Tiegel‚ Topf für alchemistische Versuche bzw. lateinisch testum, zu: testa = Platte, Deckel; (Ton)schale, Scherbe.';
/** SEO friendly content */
$seo_allowed_chars_pattern = '([^\w\s\p{L}.,;:!?\-\/\(\)\[\]…«»#@])';
$meta_title = mb_ereg_replace($seo_allowed_chars_pattern, '', $title);
$meta_description = mb_ereg_replace($seo_allowed_chars_pattern, '', $description);
/**
@oliveratgithub
oliveratgithub / alternate-hreflang.html
Last active May 10, 2021 20:57
International targeting SEO code snippets – Sitecore Symposium 2018 Handout. Sources: https://www.sitemaps.org/protocol.html and https://support.google.com/webmasters/answer/189077?hl=en
<link rel="alternate" hreflang="x-default" href="https://www.mysite.com/" />
<link rel="alternate" hreflang="de" href="https://www.mysite.com/de-de" />
<link rel="alternate" hreflang="en" href="https://www.mysite.com/en-de" />
<link rel="alternate" hreflang="es" href="https://www.mysite.com/es-es" />
<link rel="alternate" hreflang="fr" href="https://www.mysite.com/fr-fr" />
<link rel="alternate" hreflang="zh" href="https://www.mysite.com/zh-cn" />
<link rel="alternate" hreflang="zh-CN" href="https://www.mysite.com/zh-cn" />
<link rel="alternate" hreflang="en-US" href="https://www.mysite.com/en-us" />
<link rel="alternate" hreflang="de-DE" href="https://www.mysite.com/de-de" />
<link rel="alternate" hreflang="en-DE" href="https://www.mysite.com/en-de" />