grep -R 'string' directory
to recursively find a string in multiple files under a directory and then replace the string with something else
grep -R 'string1' directory | xargs sed -i 's/string1/string2/g'
1 | |
00:03:59,000 --> 00:04:01,037 | |
ÉÉÉgua, pai! | |
Essa história é muito joiada! | |
2 | |
00:04:01,302 --> 00:04:03,707 | |
E os ninjas eram mais invocados | |
do que corrida de pato! |
cd /Users/rpietro/anaconda/lib/python2.7/site-packages/django/bin python django-admin.py startproject website python manage.py startapp homepage rm views.py mkdir views touch views/init.py mkdir templates subl templates/test.html
A few notes from Jennifer Campbell & Paul Gries' outstanding Coursera MOOC Crafting Quality Code
\[a \in {x|P(x)} \]
\[\mathbb{Z} \]
# script from http://goo.gl/7m0GGp | |
# Solving Equations Exactly | |
x = var('x') | |
solve(x^2 + 3*x + 2, x) | |
x, b, c = var('x b c') | |
solve([x^2 + b*x + c == 0],x) | |
x, y = var('x, y') |
# source http://goo.gl/1zB4ee | |
# Calculus I | |
f(x)=x^3+1 | |
f(2) | |
show(f) | |
lim(f,x=1) | |
lim((x^2-1)/(x-1),x=1) | |
lim(f,x=1,dir='-'); lim(f,x=1,dir='right'); f(1) |
# code from http://nltk.org/book | |
from __future__ import division | |
import nltk, re, pprint | |
from urllib import urlopen | |
url = "http://www.gutenberg.org/files/2554/2554.txt" # crime and punishment | |
raw = urlopen(url).read() | |
type(raw) | |
len(raw) |
# code from http://nltk.org/book | |
import nltk | |
# nltk.download() # just go ahead and download everything if you have space | |
from nltk.book import * | |
from __future__ import division | |
text1 | |
text2 | |
text1.concordance("monstrous") |