Skip to content

Instantly share code, notes, and snippets.

@xenogenesi
xenogenesi / vlc-ffmpeg-thumbnail.lua
Last active April 17, 2019 21:00
lua extension for vlc to generate thumbnail of the current frame using ffmpeg
-- generate thumbnail jpeg of the current selected frame using ffmpeg
-- name convention for minidlna or synology
-- install in ~/.local/share/vlc/lua/extensions/Thumbnail2.lua
-- tested on linux only
function descriptor()
return {
title = "Thumbnail2 generator";
@xenogenesi
xenogenesi / Makefile
Last active November 19, 2021 03:28
create self signed certificates
DOMAIN ?= mydomain.com
COUNTRY := IT
STATE := IT
COMPANY := Evil Corp.
# credits to: https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309
# usage:
@xenogenesi
xenogenesi / apiresponsebool.diff
Created May 11, 2018 18:47
fix meinside/telegram-bot-go's EditMessageText response
diff --git a/methods.go b/methods.go
index 55a6eca..7c997a7 100644
--- a/methods.go
+++ b/methods.go
@@ -723,7 +723,7 @@ func (b *Bot) AnswerCallbackQuery(callbackQueryID string, options map[string]int
// other options: parse_mode, disable_web_page_preview, and reply_markup
//
// https://core.telegram.org/bots/api#editmessagetext
-func (b *Bot) EditMessageText(text string, options map[string]interface{}) (result APIResponseMessage) {
+func (b *Bot) EditMessageText(text string, options map[string]interface{}) (result APIResponseBool) {
@xenogenesi
xenogenesi / gimp-layers-slice.py
Last active August 16, 2017 15:50
gimp py fu console script: from an image with multiple layers, cut and save each layer by transparency saving the coordinates into a json file
# from gimp py fu console
# execfile("/path/to/this-script.py")
# for each layer use magic wand at pixel 1,1 (assume it is transparent), and create a selection, inverse it, transform to rectangle bounding box
# copy it and paste into a new image, save as png (and save the original coordinates into a json { "layer-name": [ x1, y1, x2, y2 ] }
from array import array
savepath="/tmp/slices/"
f = open("{0}images.json".format(savepath), "w")
@xenogenesi
xenogenesi / phing.find_relative_path.xml
Last active July 31, 2017 09:44 — forked from ohaal/find_relative_path.func.php
Phing AdhocTask to find the relative path between two paths
<!--
Usage:
<relative-path from="${from}" to="${to}"
output="project_property" />
-->
<adhoc-task name="relative-path"><![CDATA[
class RelativePath extends Task {
private $from;
private $to;
private $output;
@xenogenesi
xenogenesi / actionMigrateUp.php
Created July 29, 2017 13:08
Yii2 actionMigrateUp
<?php
public function actionMigrateUp()
{
// https://github.com/samdark/yii2-webshell
// https://github.com/samdark/yii2-webshell/issues/3
// https://github.com/tebazil/yii2-console-runner/blob/master/src/ConsoleCommandRunner.php
// https://stackoverflow.com/a/28820239/2498790
/* // if exec() is available
@xenogenesi
xenogenesi / apt-local-mirror.sh
Created July 7, 2017 07:56
shell script to mirror locally a subset of packages from an external repository
#!/bin/sh -e
# - create a root directory (into /var/local or similar, eg: apt-repos/)
# - create a somerepo.conf file (will be sourced by this script)
#
# # _URL+_DIR is the path to download the source Packages.gz
# # "Filename:" in Packages is relative to _URL (eg: _URL/pool/...)
# SRC_REPO_URL="http://some-url"
# SRC_REPO_DIR="dists/sid/main/binary-amd64"
#
@xenogenesi
xenogenesi / fbpanel-sysmenu-dot-desktop-term.diff
Created January 8, 2017 16:44
fbpanel patch to enable terminal commands in system-menu plugin from .desktop files
--- a/plugins/menu/system_menu.c
+++ b/plugins/menu/system_menu.c
@@ -4,6 +4,10 @@
#include <glib/gstdio.h>
#include <string.h>
#include <time.h>
+#define PREPEND_TERMINAL
+#ifdef PREPEND_TERMINAL
+#include <stdlib.h>
+#endif
myprompt_precmd() {
setopt noxtrace noksharrays localoptions
local exitstatus=$?
local git_dir git_ref
psvar=()
[[ $exitstatus -ge 128 ]] && psvar[1]=" $signals[$exitstatus-127]" || psvar[1]=""
local TERMWIDTH
(( TERMWIDTH = ${COLUMNS} - 1 ))