$ 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
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 | |
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 |
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
struct Seqs<I> { | |
iter: I, | |
} | |
impl<'a, I: Iterator<Item = &'a u8>> Iterator for Seqs<std::iter::Enumerate<I>> { | |
type Item = (usize, usize); | |
fn next(&mut self) -> Option<Self::Item> { | |
// Jump to first byte '1' | |
let start = loop { |
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
git clone --depth 1 https://github.com/torvalds/linux.git | |
cd linux | |
rg --json \ | |
--mmap \ | |
--multiline \ | |
'^SYSCALL_DEFINE\d+\s*?\((?s).*?\)' \ | |
| jq -r ' | |
select(.type == "match") |
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
# Usage: | |
# | |
# $ awk -f block.awk -v START="fn myfunc" foo.rs bar.rs | pygmentize -l rs | |
{ | |
if(acc == 0) { | |
if($0 ~ START) { | |
indent = match($0, /[^[:space:]]/) | |
acc = $0 | |
} |
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 | |
set -euo pipefail | |
case "${1:-}" in | |
next) | |
MEMBER=Next | |
;; | |
previous) |
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
async function keysFromPassword(salt, password) { | |
let enc = new TextEncoder().encode(password); | |
let basekey = await crypto.subtle.importKey("raw", enc, "PBKDF2", false, ["deriveBits"]); | |
let keys = await crypto.subtle.deriveBits( | |
{ | |
name: 'PBKDF2', | |
hash: 'SHA-512', | |
salt: salt, | |
iterations: 1e5 |
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 | |
require "erb" | |
require "etc" | |
if ARGV.empty? | |
puts "Usage: #$0 files... > output.html" | |
exit 1 | |
end |
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 | |
MAC=01_23_45_67_89_AB | |
FILTER=$(paste -sd, <<FILTER | |
type='signal' | |
sender='org.bluez' | |
interface='org.freedesktop.DBus.Properties' | |
path='/org/bluez/hci0/dev_$MAC' | |
member='PropertiesChanged' |
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 | |
export AWS_DEFAULT_REGION=${REGION:-eu-west-1} | |
aws ec2 describe-addresses \ | |
--query 'Addresses[*][InstanceId, PublicIp]' \ | |
--output text \ | |
| while read ID IP | |
do | |
echo -en "$IP\\t" |