Skip to content

Instantly share code, notes, and snippets.

View tatianass's full-sized avatar

Tatiana tatianass

View GitHub Profile
@tatianass
tatianass / download_images_website
Created February 28, 2020 12:07
How to download images for websites and multiple links and save it in different folders.
from bs4 import BeautifulSoup, SoupStrainer
import requests
import os
import urllib
# Could be .png or other image type.
match_str = '.webp'
# Access many links in sequence.
@tatianass
tatianass / get_all_kaggle_datasets_with_tags.py
Last active March 17, 2019 04:10
Code to download all Kaggle database references, including tags.
#!/usr/bin/python
from kaggle.api.kaggle_api_extended import KaggleApi
import csv, sys, os
# Authentificaiton
# Make sure to set your username and key in your enviroment variables.
api = KaggleApi()
api.authenticate()
@tatianass
tatianass / count_walks.py
Created December 15, 2017 05:22
Count all possible walks from a source to a destination with exactly k edges based on http://www.geeksforgeeks.org/count-possible-paths-source-destination-exactly-k-edges/
def count_walks(graph, u, v, k):
if(k == 0 and u == v): return 1
if(k == 1 and graph[u][v]): return 1
if(k <= 0): return 0
count = 0
for i in range(0, 5):
if(graph[u][i]):
count += count_walks(graph, i, v, k-1)
from rauth.service import OAuth1Service, OAuth1Session
# Get a real consumer key & secret from: http://www.goodreads.com/api/keys
key = '<API_KEY>'
secret = '<API_SECRET>'
goodreads = OAuth1Service(
consumer_key=key,
consumer_secret=secret,
name='goodreads',
request_token_url='http://www.goodreads.com/oauth/request_token',
#first attempt at implementing horizon plots in ggplot2
#pleased with result but code sloppy and inflexible
#as always very open to improvements and forks
if(!require(reshape2)){
install.packages("reshape2")
}
if(!require(quantmod)){
install.packages("quantmod")
}
if(!require(PerformanceAnalytics)){