Skip to content

Instantly share code, notes, and snippets.

View Boldewyn's full-sized avatar

Manuel Strehl Boldewyn

View GitHub Profile
@mathiasbynens
mathiasbynens / README.md
Last active June 3, 2023 08:09
Quick and dirty user script that displays a Markdown-formatted link to the current code point detail page after double-clicking the title

Try it on the detail page for U+1F4A9 PILE OF POO, for example.

Screenshot after double-clicking the <h1>:

@cowboy
cowboy / get-script.js
Last active December 23, 2015 23:59
javascript: get last script by src filename
// For Remy
function getLastScriptBySrc(filename) {
var scripts = document.scripts;
var i = scripts.length - 1;
while (i--) {
if (scripts[i].src.slice(-filename.length) === filename) {
return scripts[i];
}
}
@TheMcMurder
TheMcMurder / index.html
Last active March 14, 2023 17:51
Convert SVG file from absolute to relative
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<div class="page-header">
<center>
@Ed-von-Schleck
Ed-von-Schleck / gist:6391140
Last active December 22, 2015 00:39
Argumentor - generator a command line interface
import sys
if sys.version_info.major != 3 or sys.version_info.minor < 3:
print("This module requires Python version 3.3 or later")
sys.exit(1)
import argparse
import inspect
class Argumentor:
@Boldewyn
Boldewyn / evaluate_404s
Created August 28, 2013 09:27
Use bash-foo to print all Apache log 404s in the order how often they appeared
#!/bin/bash
LOGFOLDER=/var/log/apache2
FIELD=7
HTTP_CODE=404
LOG_BASENAME=access.log
cd "$LOGFOLDER"
# print all zipped logfiles (suppressing errors)
@coffeemug
coffeemug / gist:6168031
Last active February 3, 2022 23:16
The fun of implementing date support
After spending the better part of the month implementing date support
in RethinkDB, Mike Lucy sent the team the following e-mail. It would
have been funny, if it didn't cause thousands of programmers so much
pain. Read it, laugh, and weep!
-----
So, it turns out that we're only going to support dates between the
year 1400 and the year 10000 (inclusive), because that's what boost
supports.
@don1138
don1138 / font-stacks.css
Last active April 25, 2024 15:41
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* System (Bootstrap 5.2.0) */
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
@Boldewyn
Boldewyn / mk
Last active December 17, 2015 07:48
Search Makefiles recursively and run make(1) there, if one is found
#!/bin/bash
#
# Search Makefiles recursively and run make(1) there, if one is found
#
DEPTH=$(pwd | tr -c -d / | wc -c)
MOD=.
while [[ $DEPTH > 0 ]]
do
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@neoascetic
neoascetic / signals.py
Last active June 29, 2017 17:57
[Django] Optimize easy-thumbnails (PIL) generated images
# On Debian, you need to install these packages:
# jpegoptim optipng pngcrush advancecomp
import subprocess
from os.path import splitext
from django.dispatch import receiver
from easy_thumbnails.signals import saved_file, thumbnail_created
# on-save image optimization