Skip to content

Instantly share code, notes, and snippets.

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 ))
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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";
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-si