Skip to content

Instantly share code, notes, and snippets.

View process-reaper.c
/* From the 'musl-tools' package:
* $ musl-gcc -Wall -Os -static -o test test.c
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
void nothing(int signum) {}
ayosec /
Last active July 14, 2022 23:49
Show image thumbnails using Sixel graphics.
# Usage:
# $ list-images [files]*
# This script is a demo to show how to use hyperlinks with images in Alacritty.
# It can be used on any terminal emulator with Sixel support, but it is not
# intended to be used for regular use, mostly because it lacks a proper way to
# handle errors (it just dies).
ayosec / clear-sixel-reg.rb
Created July 14, 2022 22:02
Clear pixels on a specific color register in a Sixel image.
View clear-sixel-reg.rb
#!/usr/bin/env ruby
# Usage:
# $ clear-sixel-reg register? files*
# The script reads Sixel images, are replaced every pixel using the
# specified color register with holes. The output is always sent to stdout.
# The `background selector` parameter of the protocol selector is forced
import os, sys
from ctypes import CDLL
libc = CDLL("")
CLONE_NEWNS = 0x00020000
CLONE_NEWCGROUP = 0x02000000
CLONE_NEWUTS = 0x04000000
CLONE_NEWIPC = 0x08000000
CLONE_NEWUSER = 0x10000000
ayosec /
Created April 30, 2022 19:43
Use MPV to remove unwanted media files with <d>

Use MPV to remove unwanted media files with d.

  • mpv.conf:

    d run mv -v "${filename}" /tmp/discard/ ; show-text "moved" ; playlist-next
ayosec / index.js
Created March 19, 2022 14:17
Function for CloudFlare Pages to use an `index.txt` file as the main page.
View index.js
// Path: <root>/functions/index.js
export async function onRequest(ctx) {
const url = new URL(ctx.request.url);
return await fetch(`${url.origin}/index.txt`);
ayosec /
Last active January 10, 2022 21:59
Get data from an Android application

Get data from an Android application

  • Find the package name of the application:

    $ adb shell pm list packages
  • Download a backup, with no password:

ayosec / remove-bright-colors.rb
Created January 6, 2022 15:20
Launch a program and remove bright colors from its output.
View remove-bright-colors.rb
# If either stdout or stderr is not a TTY, executes the program with no color
# translation.
if !STDOUT.tty? or !STDERR.tty?
ayosec /
Last active January 4, 2022 01:11
Recurring tasks in TaskWarrior
# On the 15th of every month.
# Show the task 5 days before the date.
DESCRIPTION='Something to do'
task add "$DESCRIPTION" \
project:"$PROJECT" \
View render.gnuplot
set term svg size 1400,1000 font "sans,30"
set output "plot.svg"
set style data fsteps
set timefmt "%Y-%m-%d"
set xlabel "Fecha (día/mes)"
set xdata time
set xrange [ '2021-11-01' : '2021-12-15' ]