Skip to content

Instantly share code, notes, and snippets.

View wrzlbrmft's full-sized avatar

Matthias wrzlbrmft

  • Munich, Germany
View GitHub Profile
@wrzlbrmft
wrzlbrmft / tumblr-archive.html
Created November 14, 2015 14:25
Bookmarklet to instantly switch to the archive view of any tumblr blog.
Drag this link into your bookmarks bar:
<a href="javascript:(function(){window.location.href=window.location.protocol+'//'+window.location.hostname+'/archive';})();">Archive</a>
@wrzlbrmft
wrzlbrmft / head-tail.txt
Created November 14, 2015 14:28
Show lines 6-8 of a text file.
# from (8-3)+1 to 8
head -n 8 file.txt | tail -n 3
@wrzlbrmft
wrzlbrmft / google-heart.txt
Created November 14, 2015 14:28
Google Heart
# sqrt(cos(x))cos(60x)+sqrt(abs(x))-0.6*(6-x^2)^0.01
http://www.google.com/search?q=sqrt(cos(x))cos(60x)%2Bsqrt(abs(x))-0.6*(6-x%5E2)%5E0.01
@wrzlbrmft
wrzlbrmft / pseudo-random.js
Created November 14, 2015 14:28
Re: Random numbers: Ads may not include code that generates or uses random numbers. (Google)
var PseudoRandom = PseudoRandom || {};
PseudoRandom.seed = 12345 * (12345 + new Date().getMilliseconds());
PseudoRandom.random = function() {
this.seed = parseInt(("" + (12345 * this.seed)).substr(0, 13));
return parseFloat("0." + ("" + this.seed).split("").reverse().join(""));
};
// Example
for (var i = 0; i < 10; i++) {
document.write(PseudoRandom.random() + "<br />");
@wrzlbrmft
wrzlbrmft / crop-video.txt
Created December 30, 2015 12:44
Crop video to a given time range.
# starting at 00:00:00, duration of 00:00:30 (hh:mm:ss)
ffmpeg -ss 00:00:00 -t 00:00:30 -i input.mp4 -acodec copy -vcodec copy output.mp4
avconv -ss 00:00:00 -t 00:00:30 -i input.mp4 -acodec copy -vcodec copy output.mp4
@wrzlbrmft
wrzlbrmft / scan-dvb-for-vlc.txt
Created January 5, 2016 21:03
Scan DVB channels for VLC.
w_scan -X -F -t 3 > channels.conf
@wrzlbrmft
wrzlbrmft / self-signed-ssl-cert.txt
Created January 7, 2016 17:03
Create a self-signed SSL certificate.
# see https://wiki.archlinux.org/index.php/Apache_HTTP_Server#TLS.2FSSL
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out server.key
chmod 400 server.key
openssl req -new -sha256 -key server.key -out server.csr
openssl x509 -req -days 1095 -in server.csr -signkey server.key -out server.crt
@wrzlbrmft
wrzlbrmft / smoother-font-rendering-alarm.txt
Created February 14, 2016 13:50
Simple way for smoother font rendering under Arch Linux ARM.
# ~/.Xresources
Xft.autohint: 0
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.lcdfilter: lcdlight
@wrzlbrmft
wrzlbrmft / git-all.sh
Created March 29, 2016 11:43
Do a git pull and status in all direct subdirectories being Git repos.
#!/usr/bin/env sh
_IFS="$IFS"
IFS=$'\n'
for i in $(find . -mindepth 1 -maxdepth 1 -type d | sort); do
if [ -d "$i/.git" ]; then
printf "$i: "
cd "$i"
@wrzlbrmft
wrzlbrmft / check-string.sh
Created March 29, 2016 11:50
Check a URL for a string and send an e-mail if found.
#!/bin/sh
CHECK_URL="https://store.google.com/"
CHECK_STRING="Nexus 5"
MAIL_TO="mail@example.org"
MAIL_SUBJECT="$CHECK_STRING"
MAIL_BODY="$CHECK_URL"
COUNT="$(curl -Ls "$CHECK_URL" | grep -c "$CHECK_STRING")"