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
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;
#!/usr/bin/env ruby
#
# Use the list from http://a3f.at/lists/linkers to build a single HTML file
# with all posts about linkers in https://www.airs.com/blog/.
require "net/http"
require "nokogiri"
# Index based on http://a3f.at/lists/linkers
INDEX = [
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios initial_term_params;
// Check if both stdin and stdout are TTYs.
void check_stdio() {
#!/usr/bin/ruby
256.times do |color|
if color < 7 || (color > 15 && (color - 16) % 36 < 18)
fg = 231
else
fg = 0
end
print "\e[38;5;#{fg};48;5;#{color}m #{color.to_s.rjust(3)} \e[m"
import Foundation
let data = "aaa 11-22 bbb 33-44 ccc"
let regex = try! NSRegularExpression(pattern: #"\d+-\d+"#)
let range = NSRange(data.startIndex..., in: data)
regex.enumerateMatches(in: data, options: [], range: range) { (match, _, _) in
print(data.substring(with: match!.range))
}
use std::arch::x86_64 as S;
fn main() {
let data: &[u8; 16] = b"1e0b98cfa67ebe20";
let pattern: &[u8; 16] = b"b98.............";
let mask;
unsafe {
let v0 = S::_mm_loadu_si128(data.as_ptr().cast());
convert input.png -colorspace hsl -channel lightness -negate output.png