Skip to content

Instantly share code, notes, and snippets.

View JoshuaGranger's full-sized avatar

Joshua Granger JoshuaGranger

  • Louisiana
View GitHub Profile
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")
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
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
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:
;; init.el --- Emacs configuration
;; --------------------------------------
;; INSTALL PACKAGES
;; --------------------------------------
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
>>> 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"}
;; init.el --- Emacs configuration
;; --------------------------------------
;; INSTALL PACKAGES
;; --------------------------------------
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
errors = {0:'pass',
1:'cmd_err',
2:'os_err',
3:'unk_err'}
def something(argument):
# do some stuff here
errno = 3
return errno
@JoshuaGranger
JoshuaGranger / hangman.py
Created January 4, 2017 02:39
A simple python hangman game using the file 'words.txt' in the same directory as the script.
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)")
% 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