This file contains hidden or 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 aiohttp import ( ClientSession, TCPConnector) | |
from aiohttp.client_exceptions import ContentTypeError | |
from ssl import create_default_context | |
# allows us to customize the session with cert files | |
def custom_session(path_to_cert=None, custom_headers=None): | |
if path_to_cert: | |
try: | |
# with open | no need for importing `os` to do path.exists |
This file contains hidden or 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
package main | |
import "fmt" | |
type CarSpecs struct { | |
horsepower int | |
torque int | |
} | |
type Car struct { |
This file contains hidden or 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 random import randint | |
def pick_the_first_recurring(choices=None, tracker=None): | |
keep_going = True | |
while keep_going: | |
for _ in choices: | |
rr = choices[randint(0,len(choices))-1] | |
if rr in tracker: | |
keep_going = False | |
tracker[rr] += 1 |
This file contains hidden or 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
#!/usr/bin/python | |
__author__ = "J_Hack92" | |
import requests | |
import json | |
from lxml import html | |
from re import sub as re |
This file contains hidden or 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
def try_except(arg_passed=None): | |
if arg_passed is not None: | |
try: | |
arg_passed['name'] # this will fail cause we passed in a string not a dict | |
except KeyError as e: | |
print('First Except: No key named {} was found'.format(e)) # |
This file contains hidden or 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 requests import get | |
host = "https://jsonmock.hackerrank.com/api/movies/search/?Title={}" | |
proxies_dict = { | |
"http" : "" | |
} | |
def doGet(url=None, proxy=None): |
This file contains hidden or 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 sys import argv | |
from glob import glob | |
from os import system | |
class usbCreator: | |
def __init__(self): | |
self.volumes = self.getVolumes() | |
self.installers = self.getInstallers() | |
self.selctedInstaller = None |
This file contains hidden or 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 FileWriter(): | |
def __init__(self): | |
print('runs asap') | |
self.filename = 'crap.txt' | |
def write2file(self, data): | |
with open(self.filename, 'w') as f: | |
f.write(data) |
This file contains hidden or 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 flask import Flask | |
from flask import request | |
from flask import jsonify | |
app = Flask(__name__) | |
# Creates a user | |
class UserObject: | |
def __init__(self, name, username, password): |
This file contains hidden or 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 tornado.ioloop | |
import tornado.web | |
import json | |
# Creates a user | |
class UserObject: | |
def __init__(self, name, username, password): | |
self.user = username | |
self.passwd = password |
NewerOlder