Skip to content

Instantly share code, notes, and snippets.

Avatar

Tatiana tatianass

View GitHub Profile
@tatianass
tatianass / download_images_website
Created Feb 28, 2020
How to download images for websites and multiple links and save it in different folders.
View download_images_website
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 Mar 17, 2019
Code to download all Kaggle database references, including tags.
View get_all_kaggle_datasets_with_tags.py
#!/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 Dec 15, 2017
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/
View count_walks.py
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)
View goodreads-oauth-example.py
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',
View horizon plot in ggplot2.r
#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)){