Skip to content

Instantly share code, notes, and snippets.

@bikubi
bikubi / wfmugpio.py
Last active Mar 26, 2021
Control a web radio stream on a Raspi with GPIO, a button and an LED.
View wfmugpio.py
#!/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 Mar 3, 2021
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') }}
View gettexts-fake-update.sh
#!/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 / README.md
Created Mar 1, 2019
Simple Purgecss setup for Roots Sage WordPress starter theme
View README.md

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 / meltimagesslideshowbob.sh
Created Sep 5, 2017
Create a slideshow from images, with blending, using ffmpeg or MLT
View meltimagesslideshowbob.sh
#!/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 Apr 11, 2020
Very simple iptables NAT systemd service
View iptables-nat.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 Apr 10, 2019
Use Quasar variables in SCSS stylesheets (incomplete)
View quasar-variables-scss.md

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 Mar 13, 2019
hack to inject better sizes attribute into WordPress Gutenberg Gallery Block
View wp-blockgallery-fixsizes.php
<?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 Nov 12, 2018
How to record a nice sounding podcast over Skype, using Linux
View howto-record-nice-sounding-podcast-skype-linux.md

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 Aug 6, 2018
create a smiley that won't be automagically emojized by facebook & copy to clipboard :‌)
View colon-zerowidthnojoin-close-parenthesis.sh
# premade for copy&paste: :‌) ;‌) :‌( :‌D :‌P <‌3
php -r "echo html_entity_decode(':&zwnj;)');" | xclip -selection clipboard
@bikubi
bikubi / run.sh
Created Aug 1, 2018
Correct Horse Battery: The Band
View run.sh
#!/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"