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
@SwadicalRag
SwadicalRag / repoloader.lua
Last active May 14, 2023 23:30
Load gmod addons from github repositories
local function FetchSync(url)
local this = coroutine.running()
http.Fetch(url,function(...)
local suc,err = coroutine.resume(this,...)
if not suc then error(err) end
end,function(...)
-- local suc,err = coroutine.resume(this,...)
-- if not suc then error(err) end
end)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@bmwalters
bmwalters / steamid.lua
Last active December 14, 2019 02:26
Lua SteamID class
-- version 1.2.0
-- ported from https://github.com/DoctorMcKay/node-steamid/blob/master/index.js
-- thanks to https://developer.valvesoftware.com/wiki/SteamID
local steamid = {}
steamid.Universe = {
INVALID = 0,
PUBLIC = 1,
BETA = 2,
@xVir
xVir / script_copy_path.md
Last active August 2, 2018 22:11
Полезный скрипт для automator

Как скопировать путь к файлу в Finder

Этот скрипт для Automator позволяет добавить в Finder кнопку "Скопировать текущий путь". Если в Finder выбран файл или папка, то будет скопирован путь к соответствующему объекту. Если ничего не выбрано, то будет скопирован путь к текущей папке.

tell application "Finder"
	set sel to the selection as text
	if sel = "" then
 set sel to the insertion location as text
@mentlerd
mentlerd / sh_grep.lua
Created January 28, 2015 12:10
Pretty printing for gmod13
-- Global 'nil' value
NIL = {}
-- Localise for faster access
local pcall = pcall
local string_len = string.len
local string_sub = string.sub
local string_find = string.find
@tylerneylon
tylerneylon / json.lua
Last active May 15, 2024 12:57
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@Uradamus
Uradamus / shuffle.lua
Last active November 3, 2023 09:39
A simple array shuffle function for Lua implementing the Fisher-Yates shuffle.
function shuffle(tbl)
for i = #tbl, 2, -1 do
local j = math.random(i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
return tbl
end
@AbigailBuccaneer
AbigailBuccaneer / gist:5943024
Last active March 14, 2019 14:58
State of Socket APIs for Garry's Mod 13

Socket APIs for Garry's Mod 13

There are several different Socket APIs for Garry's Mod. They all have slightly different APIs, and for many of them it's unclear if they work at all in Garry's Mod 13.

[LuaSocket][]

LuaSocket is 'the original' socket API for Lua. It has a very simple API that closely matches the POSIX sockets API, plus some goodies thrown in (e.g. HTTP layer, MIME type handling).

While LuaSocket doesn't support Garry's Mod, it probably wouldn't be hard to create a Garry's Mod fork of it. This has the advantages of having a high-quality library and universally-recognised API, but it would involve maintenance of a binary module.

@jdkanani
jdkanani / notepad.html
Last active April 6, 2024 17:09 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`