Skip to content

Instantly share code, notes, and snippets.

View alivesay's full-sized avatar

Andrew Livesay alivesay

View GitHub Profile
# flake8: noqa: F401
# -----------------------------------------------------------------------------
#
# MrBelvedere's MEGA-AUTO
#
# WARNING: Using auto-attack/target/follow AFK may be bannable on your shard!!!
#
# Notes:
# - Set TazUO -> Mobiles -> Follow Distance = 1 for sticky follow.
# - If radius indicator stays on, run -radius client command.
@alivesay
alivesay / EatEverything.py
Last active August 21, 2025 02:52
Legion Script: Eat Everything!
# EatEverything.py
# -----------------------------------------------------------------------------
# Eats all the defined food in your bag and drops bowls to ground.
#-------------------------------------------------------
import API
import time
# ================================ Config ================================
inline bool contains(int x, int y, Bounds rect) {
return (x <= rect.right) && (y <= rect.bottom) && (x >= rect.left) && (y >= rect.top);
}
void BuildStringFromMatrix(int* Matrix, int NumRows, int NumColumns, char* OutBuffer) {
Bounds rect = { NumColumns - 1 , NumRows - 1, 0, 0 };
int dir = 0;
int count = 0;
int x = 0;
inline int abs(int n) { return (n < 0) ? -n : n; }
char* itoa(int Value, int Base) {
static const char lookup[] = "0123456789ABCDEF";
static const size_t bufferSize = 65;
static char buf[bufferSize] = {0};
int i = bufferSize - 1;
int n = Value;
do {
template <typename T>
T worstCase(T p_psxCount, T p_floorCount) {
Cache<T> cache;
auto min = [](T a, T b) { return (a < b) ? a : b; };
auto max = [](T a, T b) { return (a > b) ? a : b; };
auto memo_W = [&cache](T n, T k, auto &&W) {
return (cache.count({n,k}) > 0) ? cache[{n,k}] : cache[{n,k}] = W(n,k,W);
};
int timeToCrossBridge(int* party, int partySize) {
if (partySize == 1) return party[0]; // 1 torch, 1 guy, no problem
if (partySize == 2) return party[1]; // easy
if (partySize < 1) return -1; // no party :(
int *p = &party[partySize - 1]; // p moves backwards from slowest
int *fastest = &party[0];
int *nextFastest = &party[1];
int time = 0;
int slowest = 0;
@alivesay
alivesay / gist:52cafba907e72e96d2845fb8c0d0c911
Created May 7, 2020 01:53
HTTP Pagination, MGET, OK 209
MGET /data
Header: PAGE=0 <-- OK 209 {data:PAGE=0, TOTAL=3}
MGET /data
Header: PAGE=1 <-- OK 209 {data:PAGE=1, TOTAL=3}
MGET /data
Header: PAGE=2 <-- OK 200 {data:PAGE=2, TOTAL=3}
"resource": "/catalog/item",
"key": "130047:1:2",
"fields":{
"bib":{
"resource": "/catalog/bib",
"key": "130047"
},
"call":{
"resource": "/catalog/call",
1 import React, { Component } from 'react';
2
3 function handleErrors(response) {
4 if (!response.ok) {
5 throw Error(response.statusText);
6 }
7 return response;
8 }
9
10
/home/alivesay/.gvm/pkgsets/go1.11.1/proficy:/home/alivesay/go:/home/alivesay/.gvm/pkgsets/go1.11.1/global