Skip to content

Instantly share code, notes, and snippets.

Manuel Strehl Boldewyn

View GitHub Profile
@Boldewyn
Boldewyn / piwik-update.sh
Created Jun 16, 2017 — forked from szepeviktor/piwik-update.sh
Piwik automatic update - bash script
View piwik-update.sh
#!/bin/bash
# Start this scipt above the /piwik directory.
# We assume that the webserver runs under www-data.
# download & verify
wget -nv "http://builds.piwik.org/piwik.zip" || exit 1
wget -nv "http://builds.piwik.org/piwik.zip.asc" || exit 2
gpg --verify piwik.zip.asc || exit 3
@Boldewyn
Boldewyn / post-merge
Created Mar 2, 2017 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@Boldewyn
Boldewyn / hyperform.js
Last active Feb 2, 2017
Hyperform built with Webpack 2
View hyperform.js
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@Boldewyn
Boldewyn / json.ne
Created Jan 26, 2017
A JSON grammar for nearley
View json.ne
@{%
const merge = d => d.join('');
const nth = n => d => d[n];
%}
@builtin "whitespace.ne"
json -> _ object _ {% nth(1) %}
| _ array _ {% nth(1) %}
View slice.py
>>> class X:
... def __getitem__(self, item):
... print isinstance(item, slice)
... print item
...
>>> y=X()
>>> y[1:3,5]
False
(slice(1, 3, None), 5)
>>> y[{'foo':'bar'}]
@Boldewyn
Boldewyn / git-cmpsize
Created Mar 15, 2016
Git command to compare size of file in working tree against index/commit
View git-cmpsize
#!/bin/bash
if [[ $1 == "--help" || $1 == "-h" ]]; then
cat <<USAGE
usage: $(basename $0) FILE [REVISION]
Compare file size between version at REVISION (default: index) and
on disk.
USAGE
exit
@Boldewyn
Boldewyn / install-font
Created Mar 15, 2016
Small script to install a font under Linux by means of symlinking to it
View install-font
#!/bin/bash
ERROR=0
mkdir -p "$HOME/.fonts"
for name in "$@"; do
if [[ ! -f $name ]]; then
echo "Can't find $name" >&2
ERROR=1
@Boldewyn
Boldewyn / http-states
Created Feb 18, 2016
Read HTTP status codes from the RFC in your shell
View http-states
#!/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 Jan 13, 2016
Enhanced Markdown viewer
View md
#!/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 Sep 14, 2018
CSS Selectors to Match `label` Elements
View Proposal for CSS :for() pseudo-class.md

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>
    <td><label>Good ol' tables</td>
You can’t perform that action at this time.