Skip to content

Instantly share code, notes, and snippets.

#!/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"
@ayosec
ayosec / highlight_word_under_cursor.vim
Created November 15, 2012 03:02
Vim: Highlight word under cursor
" When the cursor is hold on a word, that word is highlighted.
" When the cursor is moving, the highlight is hidden
set updatetime=300
au! CursorMoved * set nohlsearch
au! CursorHold * set hlsearch | let @/='\<'.expand("<cword>").'\>'
set hlsearch
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

to upper

$ gcc -O3 -Wall -Wextra upper.c -o upper-c

$ rustc -O upper.rs -o upper-rs

$ find /usr/bin/ -type f -exec strings {} + > /tmp/ascii

$ tr [[:lower:]] [[:upper:]] < /tmp/ascii | md5sum
@ayosec
ayosec / config.ru
Created August 9, 2012 13:59
HAProxy basic example
# Simple web server
# Use N_ envvar to identify the process
run lambda {|env|
[ 200, {}, "Ok @ #{ENV["N_"]}"]
}
#!/bin/bash
ffmpeg -ss 4:00:00 -i INPUT.webm -filter:a volume=0.5 half-volume.webm
ffmpeg -i INPUT.webm -t 4:00:00 -c copy start.webm
cat > files <<EOF
file 'start.webm'
file 'half-volume.webm'
EOF