Skip to content

Instantly share code, notes, and snippets.

@bikubi
bikubi / README.md
Created March 1, 2019 12:39
Simple Purgecss setup for Roots Sage WordPress starter theme

Why

  1. Sage doesn't come with Purgecss (or uncss, etc.)
  2. Say, we use Bulma -- suddenly dist/main.css grows by 400K!
  3. Let's purge it!
  4. Oh dang, we need to whitelist /\.wp-/, /\.post-type/, /myfancylightbox/...
  5. Wait we are whitelisting pretty much everything from /resource/assets/styles!
  6. Isn't there an option to purge /node_modules/**/* only?
  7. Nope.
  8. purgecss start ignore, strategically placed, to the rescue!
@bikubi
bikubi / wfmugpio.py
Last active March 26, 2021 12:42
Control a web radio stream on a Raspi with GPIO, a button and an LED.
#!/usr/bin/env python
import subprocess as sp
import RPi.GPIO as g
import time
import os
# see http://cyfta.com/?p=8480
# & listen to WFMU! http://wfmu.org
@bikubi
bikubi / gettexts-fake-update.sh
Last active March 3, 2021 15:04
Helper script for Roots' Sage starter theme: make WPML's String Translation see WordPress's l10n gettext function in PHP Blade templates, like {{ __('Foo', 'domain') }}
#!/bin/bash
# Scans blade templates for WordPress's gettext functions
# so WPML will pick them up for its String Translation.
# (WPML doesn't see something like {{ __('Hello World', 'sage') }}
# Put me into THEME/resources/assets/build
# so $fn will point to THEME/resouces and WPML can see it
# (and it's out of sage's way)
@bikubi
bikubi / meltimagesslideshowbob.sh
Created September 5, 2017 08:52
Create a slideshow from images, with blending, using ffmpeg or MLT
#!/bin/bash
# create a slideshow from images, with nice blending
# using MLT or ffmpeg
# adapted from https://superuser.com/a/834035
#
# beware of the ffmpeg command, it eats memory quickly
# USAGE
# 1 pass images as arguments
@bikubi
bikubi / iptables-nat.service
Created April 11, 2020 11:43
Very simple iptables NAT systemd service
# Very simplistic, use at your own risk. I am using this on Raspbian.
#
# put me into /etc/systemd/system
# systemctl start iptables-nat
# systemctl stop iptables-nat
# systemctl enable iptables-nat
#
# see: https://wiki.archlinux.org/index.php/Internet_sharing
# adapted from: https://github.com/gronke/systemd-iptables/blob/master/etc/systemd/system/iptables.service
@bikubi
bikubi / quasar-variables-scss.md
Last active April 10, 2019 12:51
Use Quasar variables in SCSS stylesheets (incomplete)

Quasar supports SCSS but the style variables won't be available.
Here's a possible workaround -- incomplete & untested, since I gave up, went ahead and used stylus. (This is guide is primarily directed at future me, should this become more compelling in the future.)

Install stylus-converter

yarn add --dev stylus-converter
@bikubi
bikubi / wp-blockgallery-fixsizes.php
Created March 13, 2019 11:37
hack to inject better sizes attribute into WordPress Gutenberg Gallery Block
<?php
/* Not really recommended, very dangerous. Will change entities.
* Adjust the xpath query & sizes to your needs.
*/
add_filter('the_content', function ($content) {
try {
$preamble = '<?xml encoding="utf-8" ? >';
$doc = new DOMDocument();
$doc->preserveWhiteSpace = true;
@bikubi
bikubi / howto-record-nice-sounding-podcast-skype-linux.md
Last active November 12, 2018 06:13
How to record a nice sounding podcast over Skype, using Linux

How to record a nice sounding podcast over Skype, using Pulse and Ardour

The situation: we record a podcast over Skype. We both have USB audio interfaces (Behringer U-Phoria UMC202 and 404, respectively). We each record our respective audio inputs and mix those later, manually adjusting the delay. Skype is only used for communication and is not involved in the recording.

There might be a way to do this without ardour, pulse-only. But since we have ardour in our workflow already, we prefer this way, even if it seems needlessly complicated.

Tested on Arch Linux; all referenced programs refer to Arch packages.

@bikubi
bikubi / colon-zerowidthnojoin-close-parenthesis.sh
Last active August 6, 2018 20:13
create a smiley that won't be automagically emojized by facebook & copy to clipboard :‌)
# premade for copy&paste: :‌) ;‌) :‌( :‌D :‌P <‌3
php -r "echo html_entity_decode(':&zwnj;)');" | xclip -selection clipboard
@bikubi
bikubi / run.sh
Created August 1, 2018 04:38
Correct Horse Battery: The Band
#!/bin/bash
# see http://cyfta.com/band-name-y-3-word-combos-with-exactly-1-youtube-hit/ for what this is all about.
key="YOURYOUTUBEAPIKEY"
mkdir -v q
for s in {1..1000}; do
# generate "passwords"