Skip to content

Instantly share code, notes, and snippets.

@psidex
psidex / playlist.py
Created January 30, 2017 16:22
Get all video links from a Youtube playlist
import requests
import json
"""
The Youtube API only provides a certain amount of results per page, so if there
are lots of videos in a playlist it will need multiple pages to get all the videos
"""
# EDIT THESE
api_key = "YOUTUBE V3 API KEY"
import argparse
import socket
import sys
Version = "1.0"
parser = argparse.ArgumentParser()
parser.add_argument("host", action="store", help="The host to test")
parser.add_argument("-r", action="store", dest="range", help="A range of ports to scan speperated by a -, for example: -r 125-150")
parser.add_argument("--version", action="version", version="%(prog)s {}".format(Version))
@psidex
psidex / simpleclient.py
Last active July 23, 2017 15:20
Helps test if server & client machines can connect
import socket
import sys
host = input("Host >> ")
port = int(input("Port >> "))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((host, port))
except OSError:
from mido import MidiFile
from time import sleep
import pygame, sys
count = 0
playback_gui = " "*10
print("Press CTRL+C to quit")
if len(sys.argv) < 2:
mid_file = input(".mid file path: ")
else:
mid_file = " ".join(sys.argv[1:])
import websocket
from json import loads as tojson
def on_message(ws, raw_message):
print("\nGot raw_message")
message = tojson(raw_message)
invalue = int(message["x"]["inputs"][0]["prev_out"]["value"]) / 100000000
outvalue = int(message["x"]["out"][0]["value"]) / 100000000
print("BTC in :", invalue)
print("BTC out:", outvalue) # Actual confirmed transaction
from tkinter import Tk, filedialog
import os
Tk().withdraw()
directory = filedialog.askdirectory()
filenames = os.listdir(directory)
for count, filename in enumerate(filenames):
file_extension = os.path.splitext(filename)[1]
print(filename + " -> " + str(count+1)+file_extension)
@psidex
psidex / aim.py
Last active March 15, 2019 17:33
A quickly written auto-clicker for aimbooster.com
from PIL import ImageGrab
import numpy as np
import pyautogui
from time import sleep
coords = [181, 348, 778, 765] # Game window coords
againCoords = [505, 732] # "Again" button coords
# Game window h/w
imageWidth = 597
@psidex
psidex / test.py
Created April 5, 2019 17:27
basic discord.py rewrite bot
import discord
DISCORD_TOKEN = ""
class testClient(discord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
async def on_ready(self):
@psidex
psidex / list.txt
Last active April 27, 2020 18:39
UK Takeaway Pi-hole Regex
(^|.*\.)(deliveroo)\..*$
(^|.*\.)(je-apis|je-apps|just-eat|just-eat-prod-.*)\..*$
(^|.*\.)(uber|ubereats)\..*$
@psidex
psidex / OpinionHighlighter.gs
Last active October 20, 2020 21:24
Custom Google sheets script for highlighting my & my friends movie ratings
// The columns that will contain opinions (emoji).
const opinionColumns = [16, 17, 18, 19, 20];
// The columns to change the colour of.
const toColourColumns = [15, 16, 17, 18, 19, 20];
// The weights given to each individual opinion.
const opinionWeights = {
"😍": 6,
"👍": 3,