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
# -*- coding: utf-8 -*- | |
import time | |
import sys | |
import os | |
import datetime | |
import speedtest | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from halo import Halo |
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
#/u/GoldenSights | |
import json | |
import praw | |
import random | |
import sqlite3 | |
import time | |
import traceback | |
'''USER CONFIGURATION''' |
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 praw | |
import discord | |
from halo import Halo | |
# Get your keys from https://www.reddit.com/prefs/apps/ and use type: script | |
client_id = 'xxxx' | |
client_secret = 'xxxx' | |
user_agent = 'CommieBot for Discord (by /u/impshum)' |
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 time | |
import tweepy | |
import json | |
import sys | |
import praw | |
from halo import Halo | |
consumer_key = 'XXXX' | |
consumer_secret = 'XXXX' | |
access_key = 'XXXX-XXXX' |
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
# Create a directory called comics next to the script first | |
import requests | |
n = 933 | |
while True: | |
if n == 404: | |
n += 1 | |
url = 'https://xkcd.com/{}/info.0.json'.format(n) | |
r = requests.get(url) |
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 bs4 import BeautifulSoup | |
import requests | |
def lovely_soup(url): | |
r = requests.get(url) | |
html_content = r.text | |
soup = BeautifulSoup(html_content, 'lxml') | |
return soup |
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 re | |
from collections import Counter | |
data = open('test.txt', 'r', encoding='utf-8').read() | |
words = re.findall('\w+', data.lower()) | |
counted = Counter(words) | |
common = counted.most_common() | |
for word, score in common: | |
print(word, score) |
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
[{ | |
"quoteText": "Genius is one percent inspiration and ninety-nine percent perspiration.", | |
"quoteAuthor": "Thomas Edison" | |
}, { | |
"quoteText": "You can observe a lot just by watching.", | |
"quoteAuthor": "Yogi Berra" | |
}, { | |
"quoteText": "A house divided against itself cannot stand.", | |
"quoteAuthor": "Abraham Lincoln" | |
}, { |
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 bs4 import BeautifulSoup | |
import requests | |
# reusable main soup function | |
def lovely_soup(url): # passes the url as a variable | |
r = requests.get(url) # get the requested url | |
soup = BeautifulSoup(r.text, 'lxml') # turn html content into soup | |
return soup | |
# soup helper function |
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 InstagramAPI import InstagramAPI | |
from random import randint | |
from time import sleep | |
import requests | |
import json | |
class Colour: | |
Green, Red, White, Yellow = '\033[92m', '\033[91m', '\033[0m', '\033[93m' |