Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
10
votes
Print a Christmas Tree
Shell script, 44 characters
printf %9c\\n \* 0|sed ':x
p;s/ 0/000/;tx
d'
Prints this tree:
*
0
000
00000
0000000
000000000
00000000000
0000000000000
000000 …
4
votes
Tips for golfing in Bash
Use tail recursion to make loops shorter:
These are equivalent in behavior (though probably not in memory/PID usage):
while :;do body; done
f()(body;f);f
body;exec $0
body;$0
And these are roughly …
2
votes
It's time for a clock challenge!
Bash (3 and 4): 90 bytes
d=(`sed s/./-/g<$0`);let `date +h=%H,m=%M`;echo $h ${d:0:m}'
'$[++h%24] ${d:m}
sleep 5
$0
Due to the use of $0, this script must be put into a file, not pasted into an inte …