Skip to content

Instantly share code, notes, and snippets.

@masnagam
masnagam / macos-kodi-replace-arial-ttf.sh
Created July 25, 2020 16:26
Replace arial.ttf in Kodi with Arial Unicode.ttf (macOS)
# assumed that:
# * Kodi has been installed using brew
# * `Arial based` font has been selected in `Settings | Interface | Skin`
cd /Applications/Kodi.app/Contents/Resources/Kodi/media/Fonts
mv arial.ttf arial.orig.ttf
ln -s "/System/Library/Fonts/Supplemental/Arial Unicode.ttf" arial.ttf
# then restart Kodi
@masnagam
masnagam / stz2012-recpt1-cr.patch
Last active July 15, 2020 14:28
Remove CR in log messages from stz2012/recpt1
diff --git recpt1/recpt1core.c recpt1/recpt1core.c
index 9412456..7e2a135 100644
--- recpt1/recpt1core.c
+++ recpt1/recpt1core.c
@@ -171,7 +171,7 @@ calc_cn(int fd, int type, boolean use_bell)
do_bell(bell);
}
else {
- fprintf(stderr, "\rC/N = %fdB", CNR);
+ fprintf(stderr, "C/N = %fdB", CNR);
@masnagam
masnagam / replace-mirakc-arib
Created July 6, 2020 02:20
A small script to solve the `std::out_of_range` issue on arm32 hosts
#!/bin/sh
#
# Usage: replace-mirakc-arib your/image:name
#
# Assumed that this script is performed on arm32 hosts in order to solve the `std::out_of_range` issue.
# See https://twitter.com/masnagam/status/1279962595462529025.
cat <<EOF | docker build -t $1 -
FROM masnagam/mirakc:alpine
COPY --from=masnagam/mirakc:master-alpine /usr/local/bin/mirakc-arib /usr/local/bin/
@masnagam
masnagam / rock64-armbian-build-missing-files-for-building-driver
Last active May 21, 2019 02:19
Build missing files required for building drivers (Armbian linux-headers-rockchip64 has been broken)
#!/bin/bash
# Armbian linux-headers-rockchip64 for 4.4.xxx-rockchip64 has been broken.
# Several files required for building drivers are missing.
#
# * https://forum.armbian.com/topic/9540-linux-headers-rk3399-is-broken-for-building-out-of-tree-modules-with-fix/
# * https://forum.armbian.com/topic/9602-linux-headers-41920-cubox-make-scripts-fails/
# * https://forum.armbian.com/topic/873-solved-compiling-drivers-error-no-header-files-found/
# Reboot before running this script if you have been just upgraded kernel.
@masnagam
masnagam / make-iscsi-rootfs
Last active April 22, 2019 12:17
Creates rootfs in a specified iSCSI storage
#!/bin/sh
set -eu
PROGNAME=$(basename $0)
BASEDIR=$(cd $(dirname $0); pwd)
COPY_BOOT=n
ISCSI_PORTAL=
ISCSI_TARGET=
@masnagam
masnagam / install-px4-drv
Last active September 22, 2019 05:40
Install nns779/px4_drv
#!/bin/sh
set -eu
PROGNAME=$(basename $0)
BASEDIR=$(cd $(dirname $0); pwd)
DKMS=no
ACTION=
DEPS="curl gcc make python unzip"
@masnagam
masnagam / install-docker-compose
Last active April 21, 2019 16:11
Install docker-compose
#!/bin/sh
set -eu
PROGNAME=$(basename $0)
BASEDIR=$(cd $(dirname $0); pwd)
BRANCH=
INSTALL_DIR=/usr/local/bin
CLEAN=no
'use strict';
const $ = require('jquery');
const html2canvas = require('html2canvas');
if (ARGS.length < 2) {
throw new Error('Selector is required');
}
const selector = ARGS[0];
'use strict';
let elements = document.querySelectorAll('*');
let tags = {};
for (let i = 0; i < elements.length; ++i) {
const tagName = elements[i].tagName;
if (tags[tagName] === undefined) {
tags[tagName] = 1;
} else {
tags[tagName] = tags[tagName] + 1;
'use strict';
function getDepth(element, depth) {
let maxDepth = depth;
for (let i = 0; i < element.children.length; ++i) {
let childDepth = getDepth(element.children[i], depth + 1);
if (maxDepth < childDepth) {
maxDepth = childDepth;
}
}