This file contains 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
import sys | |
import urllib2 | |
from bs4 import BeautifulSoup | |
baseUrl = 'http://www.lyricsnmusic.com/' | |
def scrapLyrics(url): | |
#Takes the url as a parameter | |
artist = url.split('/')[3].split('-') | |
artist =' '.join(artist) |
This file contains 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
SELECT email_address, COUNT(email_address) AS occurrences | |
FROM users | |
GROUP BY email_address | |
HAVING occurrences > 1 |
This file contains 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
# Call virtualenvwrapper's "workon" if .venv exists. This is modified from-- | |
# http://justinlilly.com/python/virtualenv_wrapper_helper.html | |
# which is linked from-- | |
# http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory | |
check_virtualenv() { | |
if [ -e .venv ]; then | |
env=`cat .venv` | |
if [ "$env" != "${VIRTUAL_ENV##*/}" ]; then | |
echo "Found .venv in directory. Calling: workon ${env}" | |
workon $env |
This file contains 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
FROM ubuntu:14.04 | |
RUN apt-get -qq update | |
RUN apt-get install -y python-dev python-setuptools python-software-properties | |
RUN easy_install pip | |
RUN pip install virtualenv | |
RUN virtualenv --no-site-packages /opt/env/djdocker | |
RUN /opt/env/djdocker/bin/pip install Django==1.6.8 | |
RUN mkdir /opt/apps | |
RUN (cd /opt/apps && /opt/env/djdocker/bin/django-admin.py startproject djdocker) | |
RUN cd /opt/apps/djdocker |
This file contains 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
fn main() { | |
for num in range(1i, 101i) { | |
if num % 15i == 0{ | |
println!("FizzBuzz"); | |
} | |
else if num % 3i == 0{ | |
println!("Fizz") | |
} | |
else if num % 5i == 0{ | |
println!("Buzz") |
This file contains 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
from operator import and_ | |
# An integer is odd only if its least significant bit is 1 | |
def check_even(num): | |
if and_(num, 1) == 0: | |
print "{} is even".format(num) | |
else: | |
print "{} is odd".format(num) | |
if __name__ == '__main__': |
This file contains 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 pushes the develop branch to heroku's master | |
git push heroku develop:master |
This file contains 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
# Run in verbose mode and ignore changes in the _build directory | |
rerun -v -i=_build "make html" |
This file contains 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 python | |
import sys | |
filename = '/home/kevin/.ssh/known_hosts' | |
if len(sys.argv) != 2: | |
raise Exception( | |
"Please provide the line number to be deleted") |
This file contains 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 numbers = [2, 3, 4, 66, 1]; //5 | |
// Reverses an array in place | |
function reverse(A) { | |
var count = Math.floor(A.length / 2); // 2 | |
for (var i = 0, last = A.length - 1; i < count; i++) { | |
var temp = A[i]; | |
// Swap the array elements | |
A[i] = A[last - i]; |