Skip to content

Instantly share code, notes, and snippets.

View Zwork101's full-sized avatar
💭
Not Much

Nathan Z Zwork101

💭
Not Much
View GitHub Profile
@Zwork101
Zwork101 / proxy.py
Last active March 14, 2018 22:01
part 1 of proxy.
from flask import Flask
from requests import get
app = Flask(__name__)
@Zwork101
Zwork101 / proxy.py
Created March 14, 2018 22:00
part 2 of proxy.
SITE_NAME = 'https://youtube.com'
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def proxy(path):
# ...
@Zwork101
Zwork101 / proxy.py
Last active March 14, 2018 22:30
part 3 of proxy
# ...
return get(f'{SITE_NAME}{path}').content
@Zwork101
Zwork101 / proxy.py
Created March 14, 2018 22:32
part 4 of proxy
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
@Zwork101
Zwork101 / proxy.py
Created March 14, 2018 22:36
the whole proxy file
from flask import Flask
from requests import get
app = Flask(__name__)
SITE_NAME = 'https://google.com/'
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def proxy(path):
return get(f'{SITE_NAME}{path}').content
@Zwork101
Zwork101 / bug_proxy.py
Created March 15, 2018 01:35
Fixed proxy
from flask import Flask
from requests import get
app = Flask('__main__')
SITE_NAME = 'https://google.com/'
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def proxy(path):
return get(f'{SITE_NAME}{path}').content
@Zwork101
Zwork101 / main.py
Created March 21, 2018 17:40
IT'S ALIVE
from gcode import GCode, Printer
g = GCode()
# get stuff setup
g.set_unit()
g.start_heating_extruder(230)
g.start_heating_bed(60)
g.go_home()
g.wait_heat_bed(55)
g.wait_heat_extruder(200)
import socket
import threading
def sendMsg():
while running:
try:
message = input("Send: ")
sock.send(message.encode())
except:
@Zwork101
Zwork101 / sqlite_ex.py
Last active March 29, 2018 21:20
Cool, can't wait for release!, comparing my lib vs sqlite.
from sqlite3 import connect
db = connect("item.sqlite")
cursor = db.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS Weapon(NAME text, DAMAGE integer DEFAULT 10)")
cursor.execute("DELETE FROM Weapon") # Clear everything
cursor.execute("INSERT INTO Weapon (NAME) VALUES (\"Sword\")")
@Zwork101
Zwork101 / main.py
Created March 30, 2018 14:01
logging, failing
from os import environ
import logging
from trackerbot.app import TrackerBot
bot = TrackerBot()
if __name__ == '__main__':
log = logging.getLogger('TrackerBotLogger')
handler = logging.StrFormatStyle('%(asctime)s:%(levelname)s:%(name)s: %(message)s')