Skip to content

Instantly share code, notes, and snippets.

@benhoyt
benhoyt / markov.py
Created November 11, 2023 15:45
Generate text from an input using a simple Markov chain generator
import collections, random, sys, textwrap
# Build possibles table indexed by pair of prefix words (w1, w2)
w1 = w2 = ''
possibles = collections.defaultdict(list)
for line in sys.stdin:
for word in line.split():
possibles[w1, w2].append(word)
w1, w2 = w2, word
@luccabb
luccabb / negamax_alpha_beta_pruning.py
Last active February 26, 2023 02:00
Negamax Alpha-Beta pruning
def negamax(
board: chess.Board,
depth: int,
player: int,
alpha: float = float("-inf"),
beta: float = float("inf")) -> Tuple[Union[int, chess.Move]]:
"""
This functions receives a board, depth and a player; and it returns
the best move for the current board based on how many depths we're looking ahead
and which player is playing. Alpha and beta are used to prune the search tree.
@adistomar
adistomar / music.py
Last active November 27, 2022 21:57 — forked from EvieePy/music.py
Basic music with playlist support on Rewrite
import discord
from discord.ext import commands
import random
import json
import asyncio
import itertools
import sys
import traceback
from async_timeout import timeout
from functools import partial
@Davoleo
Davoleo / spotify.md
Last active May 17, 2024 19:33
An in-depth guide on modding Spotify with updated methods to remove ads, bypass country restrictions and theme the application

Spotify Modding & Guides

This is a collections of script, patches and procedures to mod Mobile and Desktop Spotify Applications.

If you know about something that isn't listed here and you would like it to be feel free to tell me about it in the comments or send an e-mail to dav@davoleo.net

Table of Contents

@LambdAurora
LambdAurora / optifine_alternatives_fabric.md
Last active May 16, 2024 00:04
Recommended OptiFine alternatives on Fabric

The list is moving out!

If you share this list, please use this link instead: https://lambdaurora.dev/optifine_alternatives

It may still be only a redirection link, but it will have a better web display of the list soon. And the list being on GitHub/GitHub pages improves load times.

The gist version of this list will stop being updated.

Why?

@EvieePy
EvieePy / music.py
Last active March 7, 2024 21:00
Basic music with playlist support on Rewrite
"""
Please understand Music bots are complex, and that even this basic example can be daunting to a beginner.
For this reason it's highly advised you familiarize yourself with discord.py, python and asyncio, BEFORE
you attempt to write a music bot.
This example makes use of: Python 3.6
For a more basic voice example please read:
https://github.com/Rapptz/discord.py/blob/rewrite/examples/basic_voice.py