This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Combine multiple squashfs files. | |
# | |
# Usage: | |
# | |
# $ ../combine-squashfs file1.squashfs file2.squashfs … | |
set -xeuo pipefail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table, tbody { | |
counter-reset: rownumber | |
} | |
tr { | |
counter-increment: rownumber | |
} | |
tr > td:first-child:before { | |
content: counter(rownumber); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert input.png -colorspace hsl -channel lightness -negate output.png |