Skip to content

Instantly share code, notes, and snippets.

🤔

Dan Douglas ormaaj

🤔
Block or report user

Report or block ormaaj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@izabera
izabera / timer
Created Feb 1, 2016
parse a block of code correctly even with heredocs or compound commands or pipelines or ...
View timer
#!/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
View complete-e
#!/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 {
@Keith-S-Thompson
Keith-S-Thompson / README.md
Last active May 31, 2019
Discussion of korn.c, 1987 IOCCC entry, mentioned in http://stackoverflow.com/a/19214007/827263
View README.md

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:

@MicahElliott
MicahElliott / colortrans.py
Created Nov 29, 2010
Convert values between RGB hex codes and xterm-256 color codes.
View colortrans.py
#! /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
You can’t perform that action at this time.