This file contains hidden or 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
reduce( lambda x, y: x + y, [ reduce( lambda x, y: x + y, [ ( j + 1 ) * ( ord( i ) - 64 ) for i in x[ j ] ] ) for j in xrange( len( x ) ) ] ) |
This file contains hidden or 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/sh | |
cp_p() | |
{ | |
strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \ | |
| awk '{ | |
count += $NF | |
if (count % 10 == 0) { | |
percent = count / total_size * 100 | |
printf "%3d%% [", percent | |
for (i=0;i<=percent;i++) |
This file contains hidden or 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
a.tag { | |
display: block; | |
float: left; | |
height: 19px; | |
padding: 0 2px 0 0; | |
background: url(http://cdn.last.fm/flatness/icons/tag/1/globaltag_right.png) no-repeat right top; | |
color: #fff; | |
font-size: 11px; | |
text-decoration: none; | |
vertical-align: middle; |
This file contains hidden or 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
if which pbpaste > /dev/null; then | |
# build git clone command from clipboard | |
git-clone-clipboard() { | |
REPO_URL="$(pbpaste)" | |
REPO_BASE_NAME=${$(basename $REPO_URL)%.git} | |
LBUFFER="nocorrect git clone $REPO_URL $REPO_BASE_NAME" | |
} | |
zle -N git-clone-clipboard | |
bindkey "^Xg" git-clone-clipboard | |
fi |
This file contains hidden or 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
var string = (<r><![CDATA[ | |
The text string goes here. Since this is a XML CDATA section, | |
stuff like <> work fine too, even if definitely invalid XML. | |
]]></r>).toString(); |
This file contains hidden or 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 | |
# clear the screen | |
tput clear | |
# Move cursor to screen location X,Y (top left is 0,0) | |
tput cup 3 15 | |
# Set a foreground colour using ANSI escape | |
tput setaf 3 |
This file contains hidden or 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
Function.prototype.delay = function(s){ setTimeout(this, s*1000); }; | |
Date.prototype.addDays = function(days){ return new Date(this.getTime() + (days*1000*60*60*24)); } |
This file contains hidden or 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
http://www.zsh.org/mla/users/2003/msg00167.html | |
zcalc () { print $(( ans = ${@:-ans} )) } |
This file contains hidden or 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
set wildignore+=*.o,*.r,*.class,*.pyc,*.so,*.sl,*.tar,*.tgz,*.gz,*.dmg,*.zip,*.pdf,CVS,.svn,.git,CVS/,.svn/,.git/ |
This file contains hidden or 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
require 'rake/clean' | |
require 'rake/testtask' | |
require 'fileutils' | |
require 'date' | |
def stop_error(message) | |
puts "ERROR: #{message}" | |
exit(1) | |
end |