Skip to content

Instantly share code, notes, and snippets.

OPERAND_PRIORITY = {"-": 1, "+": 1, "/": 2, "*": 2, "^": 3}
def get_tail_priority(operands: list[str]) -> int:
"""Get operand priority for tail element
Args:
operands (list[str]): Stack/List of operands
Returns:
@imjuniper
imjuniper / discord-verification-rundown.md
Last active February 18, 2024 13:40
Rundown of all the info about Discord's bot verification

Quick rundown of the Discord bot verification situation.

Remember, there's not rush to get verified before October 7th, since verification takes about 5 days anyways. If you are in less than a 100 servers, no need to worry, your bot will still work as it does currently. Keep in mind some stuff is NOT official, so unless there's a source, take it with a grain of salt.

Verification

  • If you are in a team, the owner gets verified, which verifies the whole team. Source
  • If you can't provide ID verification, you could transfer ownership of your team to another member so they can do the verification process. Source
  • The Stripe verification piece is on the user itself, but the other parts of the form are per-bot.
  • You do NOT need a Stripe account to verify, only your ID. [Source](https://discordapp.com/channels/613425648685547541/6972
@marcan
marcan / smbloris.c
Last active November 22, 2022 08:32
SMBLoris attack proof of concept
/* SMBLoris attack proof-of-concept
*
* Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
*
* Licensed under the terms of the 2-clause BSD license.
*
* This is a proof of concept of a publicly disclosed vulnerability.
* Please do not go around randomly DoSing people with it.
*
* Tips: do not use your local IP as source, or if you do, use iptables to block
@Muqsit
Muqsit / loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs
Created July 16, 2017 07:58
loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs
private function loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs($directory = "/root/pmmp/plugins/CosmicCore-master/src/CosmicCore")
{
if(is_dir($directory)) {
$scan = scandir($directory);
unset($scan[0], $scan[1]); //unset . and ..
foreach($scan as $file) {
if(is_dir($directory."/".$file)) {
$this->loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs($directory."/".$file);
} else {
if(strpos($file, '.php') !== false) {
@pylover
pylover / a2dp.py
Last active May 13, 2026 04:42
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3
"""Fixing bluetooth stereo headphone/headset problem in debian distros.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
Licence: Freeware
<?php
@define("STDIN", fopen("php://stdin", "rt"));
function query($query){
echo $query;
return trim(fgets($query));
}
function out($message){
echo date("[H:i:s] ") . $message . PHP_EOL;
}
function quit($message, $code = 2){
@owainlewis
owainlewis / socket_chat.py
Created July 31, 2012 15:15
Python socket based chat server
#!/usr/bin/python3
import socket, sys, threading
# Simple chat client that allows multiple connections via threads
PORT = 9876 # the port number to run our server on
__version__ = "0.0.1"
class ChatServer(threading.Thread):
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 8, 2026 09:27
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@Daniel15
Daniel15 / 1_Twitter autoresponder bot.md
Last active November 5, 2025 12:06
Twitter autoresponder bot

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1