Skip to content

Instantly share code, notes, and snippets.

@Y-Less
Y-Less / errors.pwn
Created August 29, 2019 10:16
Idea for error codes.
#define ERROR_COUNT // NO VALUE, so it merely exists.
enum Error: // Generic function errors.
{
OK = 0,
ERR_NONE = 0,
ERR_PARAM_0,
ERR_PARAM_1,
ERR_PARAM_2,
ERR_PARAM_3,
@Y-Less
Y-Less / once.inc
Created May 20, 2019 10:42
`const` support in `foreign` and `global`.
/*
Legal:
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 the "License"; you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
@Y-Less
Y-Less / octal.inc
Last active November 13, 2018 12:59
new a = 0o100;
#if defined _INC_octal
#endinput
#define _INC_octal
#define o0 x000
#define o1 x001
#define o2 x002
#define o3 x003
#define o4 x004
#define o5 x005
@Y-Less
Y-Less / dir.sh
Created August 20, 2018 21:04
dir.sh used by all.sh
#echo 'dir:'
#echo `pwd`
if [[ "YSI-$1" == "$3" ]];
then
git ls-tree --name-only $GIT_COMMIT "YSI-$1/" | xargs -I files /d/work/rm.sh "$1" "$2" files
elif [[ "$2" == "$3.inc" ]];
then
mv "$3" "YSI-$1/"
#ls "YSI-$1/"
@Y-Less
Y-Less / rm.sh
Created August 20, 2018 21:04
rm.sh used by all.sh
#echo 'rm:'
#echo `pwd`
IFS='.' read -ra p <<< "$3"
if [[ "${p[0]}" == "YSI-$1/$2" ]];
then
# Skip files already in the target correctly.
:
elif [[ "${p[0]}" == "YSI_$1/$2" ]];
@Y-Less
Y-Less / all.sh
Created August 20, 2018 21:03
File used to split YSI in to multiple repos with full history. I actually split it up and ran it in 10 parallel versions.
declare -a arr=(
"YSI-Coding/y_functional",
"YSI-Coding/y_hooks",
"YSI-Coding/y_inline",
"YSI-Coding/y_malloc",
"YSI-Coding/y_remote",
"YSI-Coding/y_stringhash",
"YSI-Coding/y_timers",
"YSI-Coding/y_unique",
"YSI-Coding/y_va",
@Y-Less
Y-Less / remotes.sh
Created August 20, 2018 21:02
File used to set remotes for all the YSI repos.
declare -a arr=(
"YSI-Coding/y_functional"
"YSI-Coding/y_hooks"
"YSI-Coding/y_inline"
"YSI-Coding/y_malloc"
"YSI-Coding/y_remote"
"YSI-Coding/y_stringhash"
"YSI-Coding/y_timers"
"YSI-Coding/y_unique"
"YSI-Coding/y_va"
@Y-Less
Y-Less / readme.sh
Created August 20, 2018 21:01
File used to generate all the YSI repo readmes.
declare -a arr=(
"YSI-Coding/y_functional"
"YSI-Coding/y_hooks"
"YSI-Coding/y_inline"
"YSI-Coding/y_malloc"
"YSI-Coding/y_remote"
"YSI-Coding/y_stringhash"
"YSI-Coding/y_timers"
"YSI-Coding/y_unique"
"YSI-Coding/y_va"
@Y-Less
Y-Less / rotate-selection.py
Created March 7, 2018 03:07
Select two+ bits of code, hit the assigned hotkey, watch them swap positions.
# (c) Y_Less 2018
# MPL 1.1
# Multi-selection rotation script for Notepad++ Python Script plugin.
count = editor.getSelections()
if count > 1:
editor.beginUndoAction()
total = editor.getLength()
cuts = []
@Y-Less
Y-Less / pvarvvar.pwn
Last active October 28, 2017 12:39
Compare PVars, GVars, SVars, properties, locals, and globals.
#define INCLUDE_PROFILINGS
#include <a_samp>
#include <YSI_Core\y_profiling>
#include <gvar>
static
gPlayerid,
gVar,
gDest;