Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# Combine multiple squashfs files.
#
# Usage:
#
# $ ../combine-squashfs file1.squashfs file2.squashfs …
set -xeuo pipefail
@ayosec
ayosec / mpv-remove-files.md
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
ayosec / index.js
Created March 19, 2022 14:17
Function for CloudFlare Pages to use an `index.txt` file as the main page.
// 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
ayosec / android-app-data.md
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
ayosec / remove-bright-colors.rb
Created January 6, 2022 15:20
Launch a program and remove bright colors from its output.
#!/usr/bin/ruby
CHILD_CMD = ARGV.dup
# If either stdout or stderr is not a TTY, executes the program with no color
# translation.
if !STDOUT.tty? or !STDERR.tty?
exec(*CHILD_CMD)
end
@ayosec
ayosec / taskwarrior-recurring-tasks.sh
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.
PROJECT=foo.bar
DESCRIPTION='Something to do'
task add "$DESCRIPTION" \
project:"$PROJECT" \
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' ]
table, tbody {
counter-reset: rownumber
}
tr {
counter-increment: rownumber
}
tr > td:first-child:before {
content: counter(rownumber);
@ayosec
ayosec / docker-volumes-usage.sh
Created November 8, 2021 21:26
web_publica/spec/fixtures/images/rails.png
#!/bin/bash
#
# Compute disk usage for every Docker volume.
docker volume ls --filter driver=local --format '{{.Name}}\t{{.Mountpoint}}' \
| while IFS=$'\t' read -rs -a ITEM
do
name=${ITEM[0]}
path=${ITEM[1]}
#define _GNU_SOURCE
#include <link.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
struct link_map *m;
ElfW(Dyn) *dynsec;