Skip to content

Instantly share code, notes, and snippets.

View rgaudin's full-sized avatar

rgaudin rgaudin

  • yɛlɛman
  • Bamako, Mali
View GitHub Profile
@rgaudin
rgaudin / zimwriterfs.py
Created May 27, 2024 13:24
zimwriterfs python implementation (based on zimscraperlib)
#!/usr/bin/env python3
""" zimwriterfs alternative implementation
requires libmagic1 and zimscraperlib (python)
WARN: the following zimwriterfs features are not implemented:
`--inflateHtml`
`--skip-libmagic-check`
"""
@rgaudin
rgaudin / Makefile
Created September 1, 2023 16:05
Mini libzim tester
DISTDIR=./libzim_dist
LIBDIR=$(DISTDIR)/lib
DYLD_LIBRARY_PATH=$(LIBDIR)
TARGET ?= macos-x86_64
all: zimls
libzim_dist:
curl -L -O https://download.openzim.org/release/libzim/libzim_$(TARGET)-8.2.1-1.tar.gz \
&& tar xf libzim_$(TARGET)-8.2.1-1.tar.gz \
@rgaudin
rgaudin / zimls.py
Created August 21, 2023 08:19
List content of a ZIM file
#!/Users/reg/src/wikihow/.venv/bin/python3
# !/usr/bin/env python3
import argparse
import logging
import sys
import humanfriendly
from zimscraperlib.zim.archive import Archive
@rgaudin
rgaudin / sw.js
Created May 22, 2023 09:15
wabac.js
This file has been truncated, but you can view the full file.
/*! sw.js is part of Webrecorder project. Copyright (C) 2020-2023, Webrecorder Software. Licensed under the Affero General Public License v3. */
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 9742:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
@rgaudin
rgaudin / ziminfo.py
Created March 27, 2023 13:32
Print basic information about a ZIM (via python-libzim)
#!/usr/bin/env python3
import argparse
import pathlib
import sys
import traceback
try:
from libzim.reader import Archive
except ImportError as exc:
@rgaudin
rgaudin / zimrecreate.py
Last active March 23, 2023 13:52
Python implementation if zimrecreate that also allows updating metadata
#!/usr/bin/env python3
import argparse
import base64
import pathlib
import re
import sys
import traceback
from typing import List, Optional
@rgaudin
rgaudin / videojs-ogvjs.js
Last active September 27, 2021 09:33
Fixed videojs-ogvjs for .webm extensions
/**
* videojs-ogvjs
* @version 1.3.1
* @copyright 2016 Derk-Jan Hartman
* @license (MIT OR Apache-2.0)
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojsOgvjs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
'use strict';
@rgaudin
rgaudin / web-handler.js
Last active June 28, 2021 14:35
Helper for Webp Hero, triggering polyfill off a list as WebP's lib doesn't support decoding several at once
function extend(obj, src) {
for (var key in src) {
if (src.hasOwnProperty(key)) obj[key] = src[key];
}
return obj;
}
var WebPHandler = (function() {
var defaults;
--- setup.py 2020-05-06 16:24:31.000000000 +0000
+++ setup2.py 2020-10-09 13:23:23.000000000 +0000
@@ -1234,9 +1234,7 @@
define_macros=[("PY_SSIZE_T_CLEAN", None)],
)
ext_modules.append(gi_cairo_ext)
- install_requires.append(
- "pycairo>=%s" % get_version_requirement(
- get_pycairo_pkg_config_name()))
+ install_requires.append("pycairo")
@rgaudin
rgaudin / pyinstaller-pixbuf-sign.patch
Last active August 13, 2020 15:55
Pyinstaller develop branch (currently #42ab9db) patch for GdkPixbuf so it can be signed by codesign (folder structure invalid)
diff --git i/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py w/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py
index f61d9380..8ef7a4af 100644
--- i/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py
+++ w/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py
@@ -23,8 +23,8 @@ from PyInstaller.utils.hooks import (
loaders_path = os.path.join('gdk-pixbuf-2.0', '2.10.0', 'loaders')
-destpath = "lib/gdk-pixbuf-2.0/2.10.0/loaders"
-cachedest = "lib/gdk-pixbuf-2.0/2.10.0"