Last major change: 10th March 2023
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
1s/^/1 / | |
2,$g/^/-t -\ | |
s/ .*//\ | |
s/^9*$/0&/\ | |
t .\ | |
s/^.*[^9]\(9*\)$/\1 /\ | |
s/9/0/g\ | |
-s/9*$//\ | |
s/8$/9/\ | |
s/7$/8/\ |
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 | |
shopt -s expand_aliases extglob | |
__eval () { | |
unset __code __tmp __commands | |
while (( $# )); do | |
if [[ $1 && $1 = *[![:space:]]* ]]; then | |
printf "==== command ====\n%s\n=================\n" "$1" | |
time eval "$1" | |
fi |
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 | |
save=$(bind -p; bind -X) | |
function clean-up { | |
bind -r '\C-i' | |
bind -f /dev/stdin <<< "$save" | |
} | |
trap 'clean-up' RETURN | |
function write-options { |
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
test |
korn.c
is the "Best One Liner" winner of the 1987 International Obfuscated C Code Contest, by David Korn (yes, the author of the Korn Shell).
korn.hint
, as the name implies, offers some hints.
A commenter on Stack Overflow asked for some clarification. I didn't want to post spoilers on the site, so I'm posting them here instead. If you haven't already (and if you're familiar with the rules of C) I encourage you to study the program for a while first.
=====
Here's the code:
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 python | |
""" Convert values between RGB hex codes and xterm-256 color codes. | |
Nice long listing of all 256 colors and their codes. Useful for | |
developing console color themes, or even script output schemes. | |
Resources: | |
* http://en.wikipedia.org/wiki/8-bit_color | |
* http://en.wikipedia.org/wiki/ANSI_escape_code |