Skip to content

Instantly share code, notes, and snippets.

View Hunter87ff's full-sized avatar
🎯
Focusing

hunter87 Hunter87ff

🎯
Focusing
View GitHub Profile
@Hunter87ff
Hunter87ff / port_forward.py
Created June 21, 2024 15:53
py web server port forwarding using localhost.run
# prompt: basic flask app
import os
from threading import Thread
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@Hunter87ff
Hunter87ff / socket_client.py
Created June 8, 2024 12:30
Basic socketio server and client
import socketio
sio = socketio.Client(reconnection=True)
@sio.event
def connect():
print("Connected to the server")
sio.send("Hello world!")
@sio.event
def message(data):
print(f"Received message: {data}")
@sio.event
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<body id="body">
<div id="con">
<div id="red"></div>
<div id="blue"></div>
<div id="yellow"></div></div>
<style>
#body{
position: relative;
background-color: #000;
@Hunter87ff
Hunter87ff / currency_converter.py
Created October 31, 2023 15:00
Currency convertor through text message
import requests as req
from bs4 import BeautifulSoup as bs
def currency_convert(frm:str, to:str, amount:int):
frm = frm.upper()
to = to.upper()
#print(frm, to, amount)
url = f"https://xe.com/currencyconverter/convert/?Amount={amount}&From={frm}&To={to}" #you can use your api if you have
data = req.get(url).text
soup = bs(data, "html.parser")
@Hunter87ff
Hunter87ff / scrim_bot.py
Last active October 27, 2023 14:42
discord scrim managing bot v1.0
import discord, re, pytz, time
from discord.ext import commands, tasks
#from datetime import datetime
intents = discord.Intents.default()
intents.members = True
intents.presences = True
intents.message_content = True
bot = commands.AutoShardedBot(shard_count=1,command_prefix='.',intents=intents)
@Hunter87ff
Hunter87ff / time_format.py
Created October 27, 2023 14:24
time format from delta (0:40:45.3456456)
def time_format(delta): #0:40:45.3456456
delta = str(delta)
time = ""
lst = delt.split(".")[0].split(":")
if(len(lst)<=3):
h,m,s = delt.split(".")[0].split(":")
time = f"{h}hr, {m}min, {s}sec"
elif(len(lst)>3):
d,h,m,s = delt.split(".")[0].split(":")
time = f"{d}day, {h}hr, {m}min, {s}sec"
def sum(a, b, c ):
return a + b + c
def printBoard(xState, zState):
zero = 'X' if xState[0] else ('O' if zState[0] else 0)
one = 'X' if xState[1] else ('O' if zState[1] else 1)
two = 'X' if xState[2] else ('O' if zState[2] else 2)
three = 'X' if xState[3] else ('O' if zState[3] else 3)
four = 'X' if xState[4] else ('O' if zState[4] else 4)
five = 'X' if xState[5] else ('O' if zState[5] else 5)
@Hunter87ff
Hunter87ff / pointtable.html
Created July 26, 2023 10:10
point table maker
<form id="esportsForm">
<!-- <label for="org">Organization:</label> -->
<input type="text" id="org" placeholder="Org Name" name="org">
<br>
<br>
<!-- <label for="tname">Tournament Name:</label> -->
<input type="text" id="tname" placeholder="Tournament Name" name="tname">
<table>
<thead>
@Hunter87ff
Hunter87ff / index.html
Created July 21, 2023 16:09
realtime flask server
<!-- templates/index.html -->
<html>
<body>
<h1>Real-Time Website</h1>
<div id="data-container"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.3/socket.io.js"></script>
<script>
const socket = io.connect('http://' + document.domain + ':' + location.port);
import discord
import os
from discord.ext import commands
import bs4
from bs4 import BeautifulSoup
#import youtube_dl
intents = discord.Intents.default()
intents.message_content = True
intents.reactions = True