Skip to content

Instantly share code, notes, and snippets.

View blakepell's full-sized avatar

Blake Pell blakepell

View GitHub Profile
@blakepell
blakepell / color.c
Created October 20, 2021 14:43
C program to echo ANSI colors (8, 16 and 256)
#include <stdio.h>
#define CLEAR "\x1b[0m"
#define HEADER_COLOR "\x1b[31;1;4m"
/*
* Displays the ANSI colors in the 8 set, the 16 set and the 256 set.
*/
int main()
{
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.IO.Packaging;
using System.Linq;
using System.Reflection;
@blakepell
blakepell / shop-inspect-trigger.lua
Last active February 23, 2020 03:31
Avalon Mud Client (Lua): Alias to mass inspect items in a shop
-- Trigger pattern:
-- Condition: excellent \((95|96|97|98|99|100)%\)
global.inspect_results[%1] = global.inspect_results[%1] .. global.inspect_counter .. ","
-- Echo the number we're on above the item.
lua:EchoEvent("#" .. global.inspect_counter .. " is " .. %1 .. "%")
@blakepell
blakepell / pkp.json
Last active February 21, 2020 23:00
Avalon Mud Client (Lua): Alias to show PKP until next level.
{
"AliasList": [
{
"AliasExpression": "tnl",
"Command": "local levels = {0, 10, 20, 45, 60, 80, 100, 125, 150, 175, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 775, 850, 925, 1000, 1075, 1150, 1225, 1300, 1375, 1450, 1550, 1650, 1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2600, 2750, 2900, 3050, 3200, 3350, 3500, 3650, 3800, 3950, 4150, 4350, 4550, 4750, 4950, 5150, 5350, 5550, 5750, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000, 10500, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000}\r\rlocal pkp = lua:GetVariable(\"PKP\")\rlocal pkpLevel = lua:GetVariable(\"PKPLevel\")\rlocal pkpTnl = levels[pkpLevel + 2] - pkp\rlocal pkpLevelAmount = levels[pkpLevel + 2] - levels[pkpLevel + 1]\rlocal percentCompleted = ((pkpLevelAmount - pkpTnl) / pkpLevelAmount * 100)\r\rlua:Echo(\"--> \"..math.floor(pkpTnl)..\" PKP until next train. That is \".. percentCompleted ..\"% completed towards the next level.\")\rlua:Echo(\"\")\r",
"Enabled": true,
"Chara
@blakepell
blakepell / id.lua
Last active June 6, 2021 15:42
Avalon Mud Client (Lua): Alias to identify multiple items
-- Syntax: id <start index> <end index> <keyword>
-- Description: Casts the identify spell on a number of items with the same keyword.
-- Example: id 1 5 sword
-- Result: cast identify 1.sword, cast identify 2.sword, etc.
local startIndex = tonumber(getarg(1, ...))
local endIndex = tonumber(getarg(2, ...))
local item = getarg(3, ...)
for i = startIndex, endIndex, 1
do