Skip to content

Instantly share code, notes, and snippets.

View Boldewyn's full-sized avatar

Manuel Strehl Boldewyn

View GitHub Profile
@Boldewyn
Boldewyn / http-states
Created February 18, 2016 15:37
Read HTTP status codes from the RFC in your shell
#!/bin/bash
_usage() {
cat <<USAGE
usage: $(basename $0) STATUS_CODE
Print the RFC information about an HTTP status code.
USAGE
}
@Boldewyn
Boldewyn / md
Last active January 13, 2016 10:53
Enhanced Markdown viewer
#!/usr/bin/env python3
"""Render Markdown and show the result in the browser
"""
import argparse
from http.server import HTTPServer, BaseHTTPRequestHandler
from markdown import markdown
import os
import sys
@Boldewyn
Boldewyn / Proposal for CSS :for() pseudo-class.md
Last active January 21, 2021 19:33
CSS Selectors to Match `label` Elements

CSS Selectors to Match label Elements

<label> elements are notoriously hard to select with CSS in any non-trivial mark-up structure, when the state of their control is to be taken into account. Consider these frequent cases, where it is not possible to reach the label element with CSS selectors, when the corresponding input state is relevant:

1. <label><input> Input inside label</label>

2. <tr>
    <td><input></td>
 Good ol' tables

Zusammengesetzt aus:

  • U+005A LATIN CAPITAL LETTER Z
  • U+0322 COMBINING RETROFLEX HOOK BELOW

Siehe hier.

@Boldewyn
Boldewyn / pw
Last active August 29, 2015 14:15
pw: a convenient password retriever
#!/bin/bash
#
# Convenient password retrieval
#
# Get your immemorable password by its alias name.
#
# Requirements:
# * either xclip or xsel (Linux), pbclip (OSX), Cygwin's putclip (Win)
# * standard tools: sed, column, tr
# * gpg or gpg2
var tessel = require('tessel');
var ambientlib = require('ambient-attx4');
var ambient = ambientlib.use(tessel.port['A']);
var rm = 40;
ambient.on('ready', function () {
// Get points of light and sound data.
var int = setInterval( function () {
ambient.getLightLevel( function(err, ldata) {

Keybase proof

I hereby claim:

  • I am Boldewyn on github.
  • I am boldewyn (https://keybase.io/boldewyn) on keybase.
  • I have a public key whose fingerprint is D0A7 AC8C B2F0 3D52 D4DA A2FD E490 CD2B 2D29 0A4B

To claim this, I am signing this object:

@Boldewyn
Boldewyn / urlencode
Created April 15, 2014 10:39
a small URL encoding script
#!/usr/bin/python
"""Simple URL encoder"""
import argparse
import urllib
parser = argparse.ArgumentParser(description='URL-encode a string')
javascript:
'search_unicode.bookmarklet.js',
(function(){
var x='http://codepoints.net/U+'+(function(r){
var n=r.startContainer,
p=r.startOffset,
u=(n.nodeType==3)?n.nodeValue.substr(p,2):n.childNodes[p].textContent.substr(0,2),
v=u.charCodeAt(0);
return 0xD800<=v&&v<=0xDB7F?((v&0x3FF)<<10|u.charCodeAt(1)&0x3FF)+0x10000:v;
})(getSelection().getRangeAt(0)).toString(16);
@Boldewyn
Boldewyn / git-get
Last active December 22, 2016 10:37
The `git get` command to replace `git pull` with a sophisticated rebase strategy
#!/bin/bash
#
# git get
#
# Place this script in your path, so that git(1) can find it. Presto!
# You can now type `git get` instead of `git pull` and enjoy the
# advantages of rebasing atop instead of merging remote changes.
#
# If you have local changes, use `git get --stash` to stash and
# pop afterwards your changes automatically.