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
mv blob/a_long_directory_name/{c/x.x,evenmore/y.y} # Moves blob/a_long_directory_name/c/x.x to blob/a_long_directory_name/evenmore/y.y | |
# Source: http://unix.stackexchange.com/questions/89555/cp-or-mv-files-to-same-directory-they-are-already-in-when-i-am-in-another |
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
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <some.file)\r\n\r\n"; cat some.file; } | nc -l 8080 |
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
def ten_most_prolific(rows): | |
# Who are the top 10 most prolific artists in the data | |
# along with the number of their songs that appear in the data? | |
artists = [row['ARTIST CLEAN'] for row in rows] | |
c = Counter(artists) | |
sorted_c = sorted(c.items(), key=operator.itemgetter(1), reverse=True) | |
return sorted_c[:10] |
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
# This leaks in Python 2.7 but does not in Python 3+ | |
def bad_scope_list(): | |
num = range(1,10) | |
i = 4 | |
print [i for i in num] | |
print i # Prints 9 instead of 4 | |
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
#!/usr/bin/env bash | |
: <<'END' | |
Sample Run: ./list_venvs.sh /Users/talwai/ | |
Sample Output: | |
----------------------- | |
DIRECTORY: /Users/talwai/qorpus_env | |
PYTHON_VERSION: 3.3.2 | |
PACKAGES: |
NewerOlder