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
@jdkanani
jdkanani / notepad.html
Last active June 16, 2024 13:44 — 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`
@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.

@Uradamus
Uradamus / shuffle.lua
Last active September 26, 2024 21:09
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
@tylerneylon
tylerneylon / json.lua
Last active August 24, 2024 14:01
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.
@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
@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
@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,
@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

@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)
local red = Color(255,0,0)
local green = Color(0,255,0)
local function log(color,s)
MsgC(color,s .. "\n")
end
function mdmp(out)
local files,_ = file.Find("*.mdmp","BASE_PATH")
if out then log(red,"Found " .. #files .. " files!") end