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
class Profile(): | |
def __init__(self, platform, id): | |
self.user = {self.platform: platform, self.id: id} | |
self.seasons_played = [] | |
# Get the document and parse the html with BeautifulSoup4 | |
self.response = requests.get( | |
url=f"{BASE_URL}/{self.user['platform']}/{self.user['id']}") | |
self.document = self.response.text | |
self.soup = bs4.BeautifulSoup(self.document, "html.parser") |
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
soup = bs4.BeautifulSoup(document, "html.parser") | |
containers = {} | |
containers["profile"] = soup.find("div", attrs={"class": "trn-profile"}) | |
containers["current_rank_data"] = containers["profile"].find( | |
"div", attrs={"class": "card-table-container"}) | |
containers["seasons"] = containers["current_rank_data"].find_all( | |
"div", id=re.compile("^season-")) | |
# Now, there are subcontainers within containers["seasons"] that I want to |
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
using HtmlAgilityPack; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
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 requests | |
# Create a session and create the payload | |
session = requests.Session() | |
payload = {"screenname": "mytestusername", "password": "mytestpassword"} | |
home = "https://pogo.com" | |
# Post the data | |
r = session.post(f"{home}/action/pogo/login.do", data=payload) | |
with open("post.html", "w") as fout: |
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
;; init.el --- Emacs configuration | |
;; -------------------------------------- | |
;; INSTALL PACKAGES | |
;; -------------------------------------- | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(add-to-list 'package-archives |
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
>>> gist.create(name='file.py', description='none', public=1, content="hahaha") | |
Traceback (most recent call last): | |
File "<pyshell#38>", line 1, in <module> | |
gist.create(name='file.py', description='none', public=1, content="hahaha") | |
File "C:\Python36-32\lib\site-packages\simplegist\simplegist.py", line 104, in create | |
raise Exception('Gist not created: server response was [%s] %s' % (r.status_code, r.text)) | |
Exception: Gist not created: server response was [422] {"message":"Invalid request.\n\nNo subschema in \"anyOf\" matched.\nFor 'anyOf/0', 1 is not a boolean.\n1 is not a member of [\"true\", \"false\"].\nFor 'anyOf/1', 1 is not a string.\nFor 'anyOf/2', 1 is not a null.","documentation_url":"https://developer.github.com/v3/gists/#create-a-gist"} |
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
;; init.el --- Emacs configuration | |
;; -------------------------------------- | |
;; INSTALL PACKAGES | |
;; -------------------------------------- | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) |
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
errors = {0:'pass', | |
1:'cmd_err', | |
2:'os_err', | |
3:'unk_err'} | |
def something(argument): | |
# do some stuff here | |
errno = 3 | |
return errno |
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 random # For number generation | |
import re # For regular expression functionality | |
# Game setup | |
print("Welcome to Hangman!") | |
print("There are multiple difficulty settings shown below:") | |
print("\t1. Beginner (10 lives)") | |
print("\t2. Intermediate (8 lives)") | |
print("\t3. Expert (6 lives)") | |
print("\t4. Advanced (4 lives)") |
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
% Digital Signal Processing Matlab Assignment #2 | |
% Joshua Granger | |
% April 13, 2016 | |
close all; | |
clear all; | |
clc; | |
% In order to perform convolution, each signal must be of the same length. | |
% I have chosen To = 3 and zero padded f(t) accordingly |
NewerOlder