Skip to content

Instantly share code, notes, and snippets.

@fbender
fbender / index.html
Created October 19, 2024 08:56
Untitled
<form action="javascript:">
<fieldset class="rating">
<legend>Use number keys or click buttons to rate from 0 to 8, or select "Unclear" (number 9)</legend>
<div class="rating-group">
<!-- 0-8 Rating Buttons -->
<input type="radio" id="rate-0" name="rating" value="0">
<label for="rate-0" class="grouped">0</label>
<input type="radio" id="rate-1" name="rating" value="1">
@fbender
fbender / index.html
Created October 17, 2024 19:14
Untitled
<form>
<fieldset class="rating">
<legend>Use number keys or click buttons to rate from 0 to 8, or select "Unclear" (number 9)</legend>
<div class="rating-group">
<!-- 0-8 Rating Buttons -->
<input type="radio" id="rate-0" name="rating" value="0">
<label for="rate-0" class="grouped">0</label>
<input type="radio" id="rate-1" name="rating" value="1">
@fbender
fbender / fbender.zsh-theme
Created March 22, 2024 23:27
Personal ZSH theme based on steeef from official OMZ repository, heavily modified and quite verbose (WIP)
### custom Oh-My-ZSH theme by fbender
#
# verbose theme based on "steeef" from official omz repository
# - vcs_info reduced to show type, name, and branch (if available) of repository only
# - built-in slightly modified "timer" plugin from official omz repository
# - extended Python virtual environment logic, i.a. adding conda support
# - multi-line input (PS2) and debug (PS4) formatting
# - more and different colors, date and time information, running job info, and more
#
# recommended setopts: EXTENDED_HISTORY, RM_STAR_WAIT, CORRECT, CORRECT_ALL
@fbender
fbender / setup-jupyter-py-sci-conda-env.sh
Last active January 16, 2024 16:25
Baseline Scientific Python conda enviroment using VSCode for Jupyter
#!/bin/sh -
#
# Install baseline scientific packages including Jupyter kernel (e.g. into 'base' enviroment):
conda install sympy tabulate seaborn scipy ipykernel
# That's it, you don't need to install all of Jupyter into the enviroment if you "connect" from another
# Jupyter instance, e.g. through VS Code with the Jupyter extension, to this enviroment; the 'ipykernel'
# is sufficient. NumPy, matplotlib, pandas, etc. are part of the dependencies of above packages. Install
# panda's recommended dependencies if numeric operations need a speed up, esp. for large data sets; ref.
# https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html#install-recommended-dependencies
# Use 'pytables' or 'h5py' for very large data sets. For interactive plots, use 'bokeh'. Other interesting
@fbender
fbender / remount-usbdrive.sh
Last active December 19, 2023 17:23
Task source code to remount an ejected external USB drive in Synology DSM (e.g. to enable fully-automated Hyper Backup with auto-eject enabled)
# HOW TO SET UP
# - Go to Task Scheduler and create a new "user-defined script" task for "root" user.
# - Schedule task before e.g. next Hyper Backup run (my sequence is: 00:58 mount task, 01:00
# run drive integrity test, 03:00 run backup, which will eject drive again at the end).
# - Copy this file's content to the "user-defined script" field and save.
# - Make sure execution output logging is configured (e.g. saving to a shared folder).
# - Either run script once and follow next section's info, or run "lsusb" yourself via SSH.
# - Fill in device details in variables below (until "END OF CONFIGURATION").
set -euxo pipefail
lsusb
@fbender
fbender / xml-to-har.py
Last active September 14, 2020 11:19 — forked from craigds/xml-to-har.py
Convert Internet Explorer 'capture network traffic' XML to a HAR file (by @craigds, force-unicode-version).
#!/usr/bin/env python
"""
Converts Internet Explorer 'capture network traffic' XML to a HAR file.
Turns out that XML is just a HAR file anyways, but in XML form. So this
just converts it to JSON, and Bob's your uncle.
Requires Python 2.7+ and LXML.
"""
from __future__ import unicode_literals
@fbender
fbender / bootlocal.sh
Last active September 22, 2015 16:59
Since Docker Machine (ex boot2docker) does (mostly) not persist changes in the VM file system, a Discourse installation is easily broken when the VM is restarted. This script prepares the boot2docker VM on each boot so handling Discourse in Docker Machine is easer.
#!/bin/sh
# mounts a folder to /var/discourse and installs bash (required by
# Discourse launcher script)
#
# HOWTO:
#
# 1. `docker machine ssh default` into the VM
# 2. `mkdir /mnt/sda1/var/discourse`
# 3. put this script at /var/lib/boot2docker/bootlocal.sh (this file
# will be persisted through reboots)
@fbender
fbender / mirror.sh
Last active September 1, 2015 16:43
`wget` script to mirror / backup a site and its subressources even if they span across different domains
#!/bin/bash
# `wget` script to mirror / backup a site and its subressources even if they span across different domains
#
# Author: Florian Bender
# Updated: 2015-08-31
# License: MIT
#
# Copyright (c) 2015 Florian Bender <[email protected]>
#
@fbender
fbender / strawman-http-session-persistence.md
Last active August 29, 2015 14:27
[Strawman] Proposal for HTTP Session & User Identification (Persistence)

Goals

  • specify use cases of session management and persistence
  • identify use cases of Cookies not concerning session management and persistence
  • allow a website to act as an identity broker for other websites, (optionally?) factoring in OpenID/Persona/etc.
  • replace Cookies with more user control and enhanced privacy (e.g. allow use case 1 below)
  • find a technical solution for the EU Cookie Law resp. its goal
  • propose HTTP Session & User Identification as an HTTP/2 extension (allow Cookie Upgrading?)
  • propose HTTP Session & User Identification as a replacement for Cookies in HTTP/3
  • the spec behaviour should be (largely) polyfill-able via Service Workers, i.e. user agent complies with spec even though it natively does not (requires complying server)
@fbender
fbender / sleep-timer.scpt
Last active March 5, 2024 09:51
AppleScript to put your Mac to sleep after X minutes, fading out the system volume shortly before sleeping. Can be turned into an app via the "Export" feature of the AppleScript Editor.
-- written by Florian Bender, 2015
-- based on work by Michael Wyszomierski <https://wysz.com/wyszdom/2009/06/simple-sleep-timer-with-applescript/>
-- license: Public Domain / CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
tell application "System Events"
set volumeSettings to get volume settings
set volumeValue to (output volume of volumeSettings)
set fadeTime to 10 -- time in seconds for fade change
set fadeChange to (volumeValue div fadeTime)
-- display alert "Volume: " & volumeValue & ", Delta: " & fadeChange
display dialog "Sleep time (min):" default answer "25"