Skip to content

Instantly share code, notes, and snippets.

daniel-j / hdmvpgs.js
Last active Feb 14, 2022
HDMV/PGS subtitle Javascript parser
View hdmvpgs.js
'use strict'
function HDMVPGS (ctx) {
this.ctx = ctx || document.createElement('canvas').getContext('2d')
this.lastVisibleSegment = null
this.segments = []
this.loaded = false
HDMVPGS.prototype.loadBuffer = function (arraybuffer) {
daniel-j /
Created May 4, 2018
Script to read the battery drain/charge rate of the GPD Pocket, outputs wattage. Negative is draining, positive is charging.
with open(dir + 'current_avg', 'r') as f:
current = int( / 1000000.0
with open(dir + 'voltage_avg', 'r') as f:
voltage = int( / 1000000.0
wattage = voltage * current
# print('{0:.2f}V {1:.2f}A {2:.2f}W'.format(voltage, current, wattage))
daniel-j /
Last active Jul 29, 2021
Converts images in a directory to a comic/manga EPUB3 ebook. Can be used to convert extracted CBZ/CBR to EPUB3.

Converts a directory of images into a modern EPUB3 ebook. Use a tool to extract CBZ/CBR/CBT files and then run this program to generate a nice fixed-layout EPUB ebook of it. You can optionally set the reading direction to right-to-left (e.g. for manga). For Kobo ereaders, use the file extension .kepub.epub to get the modern reader and correct reading direction.


Install dependencies with pip install imagesize lxml

daniel-j / spotify.js
Last active May 25, 2021
A simple node.js program to listen to Spotify tracks, albums and playlists
View spotify.js
#!/usr/bin/env node
'use strict';
This is a simple Spotify cli-based client with optional Icecast2/shout support!
It should work for non-premium users, but you must connect your Spotify account to Facebook.
$ node spotify <spotify uris> <playlist uri> <album uri> <track uri> <etc...>
#!/usr/bin/env python
# by djazz, using various bits of code found over the web
# works with both python2 and python3
# requires: python-alsaaudio, python-numpy, python-smbus, piglow
# install piglow: curl | bash
# usage:
# this script accepts raw audio in this format: S16LE 44100 kHz Mono
# script-that-outputs-audio | python
daniel-j / obs-visualizer.html
Last active Mar 14, 2021
OBS-Studio Audio Visualizer. Add --enable-media-stream to Linux Browser command line arguments.
View obs-visualizer.html
<!DOCTYPE html>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
daniel-j / visualizer.ino
Last active Mar 12, 2021
Ardunio FFT audio visualizer, using a python script running on host |
View visualizer.ino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#define PIN 3
#define LEDS 16
#define PACKET_SZ ( (LEDS * 3) + 3 )
daniel-j / wallpaper-changer
Last active Sep 26, 2020
This is a simple random wallpaper changer to use with Awesome WM. You need to install feh to use this.
View wallpaper-changer
# Created by djazz // Dangershy
# Dependencies: feh
# to make it loop over lines instead of spaces in filenames
daniel-j /
Last active Sep 9, 2020
Fallout 3 GOTY script for Protonfixes

Fallout 3 Game of the Year Edition script for Protonfixes

This is ONLY for the Game of the Year Edition! Regular Fallout 3 edition is not supported/tested.

How to install

If you already have a working setup of Fallout 3 GOTY, I do not recommend using this script as it may break your current mods etc.

Before using this script, MAKE A BACKUP of your saves in steamapps/compatdata/22370/pfx/drive_c/users/steamuser/My Documents/My Games/Fallout3/Saves. Then delete the directory steamapps/compatdata/22370 and/or reinstall the game in Steam.

daniel-j /
Last active Mar 17, 2020
Linux updater for My Little Karaoke song and theme packages
#!/usr/bin/env bash
LD_LIBRARY_PATH="" ./ --check
./ $@