Skip to content

Instantly share code, notes, and snippets.

View AMD-NICK's full-sized avatar
🏠
Working from home

_AMD_ AMD-NICK

🏠
Working from home
View GitHub Profile
@AMD-NICK
AMD-NICK / cl_echo_visualizer.lua
Created April 26, 2017 16:16
Визуализатор "эхо". Имеет проблему с неудалением эхо после добавления, в связи с чем при большом кол-ве эхо начинает все лагать. Взято отсюда: https://facepunch.com/showthread.php?t=1440586&p=51617841&viewfull=1#post51617841
local echoes = {}
local echo_thickness = 10
local color_mask = Color(0,0,0,0)
local function drawStencilSphere( pos, ref, compare_func, radius, color, detail )
render.SetStencilReferenceValue( ref )
render.SetStencilCompareFunction( compare_func )
render.DrawSphere(pos, radius, detail, detail, color)
end
@AMD-NICK
AMD-NICK / sv_plannedrestart.lua
Created June 13, 2017 10:20
это. просто. пиздец. 2015 год. Мой первый большой Lua скрипт, который я тогда писал много часов
--[[**********************************************************
Конфигурационная зона
**************************************************************]]
local CanEnterCmd = {"governor", "admin", "superadmin", "minister"} -- Таблица, содержащая названия групп, которые могут вводить команду
local WarnTime = 10 --60 * 5 -- Время, через которое будет проводиться напоминание игрокам о рестарте
--[[**********************************************************
Оповещание "вводителя" команды
**************************************************************]]
local function report(activator, num, time, message)
@AMD-NICK
AMD-NICK / vk_wall_img_downloader.lua
Last active August 29, 2017 22:09
Скачиватель фото со стены группы VK, созданный на Gmod Lua
local VKBOT = VK.New("")
local function log(s)
file.Append("vk_img_downloader.txt",os.date("%H:%M") .. " > " .. s .. "\n")
print(s)
end
VK_IMG_QUEUE = VK_IMG_QUEUE or {}
local queue_in_process
@AMD-NICK
AMD-NICK / xor_search.lua
Last active October 27, 2017 00:24
Поиск отсутствующего числа в неотсортированной таблице
-- Для получения таблицы, типа {5,3,6,1,4,2,7} (1,7)
local function getArrayWithUniqueRandomNumbers(min,max)
local array = {}
local tmp = {} -- для расброса
for i = min,max do
table.insert(tmp,i)
end
repeat
@AMD-NICK
AMD-NICK / install_gmod_dev.sh
Last active April 7, 2020 16:34
luadev + epoe + fprofiler install script
#/bin/bash
SERV_DIR=$HOME'/gm/path_to/garrysmod'
mkdir 'tmp'
cd 'tmp'
git clone 'https://github.com/Noiwex/luadev.git' luadev
git clone 'https://github.com/Metastruct/EPOE.git' epoe
git clone 'https://github.com/FPtje/FProfiler.git' fprofiler
@AMD-NICK
AMD-NICK / docker_run_transmission.sh
Created August 10, 2018 13:39
Docker Transmission Run Command
docker run --name=transmission \
-v $PWD/config:/config \
-v $PWD/downloads:/downloads \
-v $PWD/watch:/watch \
-e TZ=Europe/London \
-p 9091:9091 -p 51413:51413 \
-p 51413:51413/udp \
linuxserver/transmission
@AMD-NICK
AMD-NICK / git_perma_auth.md
Created August 12, 2018 15:42
Permanently authenticating with Git repositories

Run following command to enable credential caching:

$ git config credential.helper store
$ git push https://github.com/repo.git

Username for 'https://github.com': <USERNAME>
Password for 'https://USERNAME@github.com': <PASSWORD>
@AMD-NICK
AMD-NICK / glua_into_single_line_minifier.lua
Last active February 16, 2021 23:20
Strips comments and convert glua script into single line file
local pat_mcomment_lua = "(%-%-%[(=*)%[.-%]%2%])"
local pat_mcomment_cpp = "(/%*.-%*/)"
local function stripMultiline(content)
return content
:gsub(pat_mcomment_lua, "")
:gsub(pat_mcomment_cpp, "")
end
-- https://img.qweqwe.ovh/1556969630528.png
-- #TODO shitcoded heavy function
@AMD-NICK
AMD-NICK / hmac.lua
Created March 11, 2019 18:07
Попытка перенести github.com/user-none/lua-hashings в Garry's Mod. Начал с sha1, т.к. нужен был sha1.hmac, но нашел его здесь: https://qweqwe.ovh/gmod-sha1-hmac и забил
-- Copyright (c) 2016 John Schember <john@nachtimwald.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
@AMD-NICK
AMD-NICK / api.lua
Last active December 29, 2023 12:52
Monobank Alerts Telegram Bot
local APIURL = "https://api.monobank.ua"
/*
Ошибки:
400 = Period must be no more than 31 days
400 = Missing required field 'from'
403 = Unknown 'X-Token' (левый токен)
429 = Too many requests
*/