Skip to content

Instantly share code, notes, and snippets.

View cobaltgit's full-sized avatar

Cobalt cobaltgit

  • United Kingdom
View GitHub Profile
@cobaltgit
cobaltgit / webhook.py
Last active January 29, 2022 11:51
Receive webhooks using Sanic
from sanic import Sanic
from sanic.response import json
from sanic.exceptions import InvalidUsage
app = Sanic(__name__)
def webhook_actions():
"""Actions to perform when webhook receives POST request"""
pass
@cobaltgit
cobaltgit / README.md
Last active January 29, 2022 11:43
Simple port scanner for Python 3.6+

Port Scanner

A simple port scanner program written in Python using the standard library

Usage

Scan all ports from 1 to 65535 on localhost

$ python portscan.py 

Scan all ports from 1 to 65535 on host google.com

@cobaltgit
cobaltgit / README.md
Last active January 26, 2024 20:03
A Guide to Discord Bot Hosting

Cobalt's Guide to Discord Bot Hosting

Here is a guide to help you what Discord bot host to pick. This was originally a tag on the discord.py server, but was moved to this GitHub gist as it eventually rolled over the 2000 character limit.

VPS Hosting (best)

I recommend a cheap VPS server as the best way to host your bot online for 24/7. Here are some good picks, credit to the discord.py server for this

Scaleway - EU
Linode - EU/US/Asia

@cobaltgit
cobaltgit / search_algos.ipynb
Last active January 14, 2023 15:31
A benchmark comparing linear and binary search algorithms - Source code compatible with Python 3.5+
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cobaltgit
cobaltgit / client.lua
Last active August 6, 2022 11:59
A basic ComputerCraft program that allows control of a turtle from a wireless pocket computer using Rednet client/server API
--> Run this program on an (advanced) wireless pocket computer in your off-hand for best results
--> Replace 'id' with the id of the turtle - run the 'id' command in the turtle's shell
rednet.CHANNEL_BROADCAST = 8000
rednet.open("back")
print("Controller open on port "..rednet.CHANNEL_BROADCAST)
while true do
rednet.send(id, io.read())
@cobaltgit
cobaltgit / Portal_Still_Alive_Changes.diff
Last active August 11, 2022 18:36
A comparison of changes between Portal: Still Alive's leaked pre-release build and the retail version
diff --git "a/.\\Portal Still Alive Beta/32_584109600002000100010001.PNG" "b/.\\Portal Still Alive Retail/32_584109600002000100010001.PNG"
index 5ed7564..7163f8a 100644
Binary files "a/.\\Portal Still Alive Beta/32_584109600002000100010001.PNG" and "b/.\\Portal Still Alive Retail/32_584109600002000100010001.PNG" differ
diff --git "a/.\\Portal Still Alive Beta/32_584109600002000100020001.PNG" "b/.\\Portal Still Alive Beta/32_584109600002000100020001.PNG"
deleted file mode 100644
index 42d6e1a..0000000
Binary files "a/.\\Portal Still Alive Beta/32_584109600002000100020001.PNG" and /dev/null differ
diff --git "a/.\\Portal Still Alive Beta/32_584109600002000100030001.PNG" "b/.\\Portal Still Alive Beta/32_584109600002000100030001.PNG"
deleted file mode 100644
index d9ae228..0000000
@cobaltgit
cobaltgit / keybase.md
Created December 12, 2022 13:18
Keybase proof

Keybase proof

I hereby claim:

  • I am cobaltgit on github.
  • I am cobaltkb (https://keybase.io/cobaltkb) on keybase.
  • I have a public key ASDrC7N86wG8hJF8WtmDvMOCQjzPfjcWMrcV9FmbIIOuDgo

To claim this, I am signing this object:

@cobaltgit
cobaltgit / chd-m3u.py
Last active April 23, 2024 12:58
Generate M3U files for CHD ROMs in a directory
import os
import re
CHD_DIR = "/path/to/chds"
chds = [*filter(lambda i: i.endswith(".chd"), os.listdir(CHD_DIR))]
games = set(name[:name.find("(")] for name in chds)
for game in games:
m3u_list = [chd + "\n" for chd in chds if game in chd]