Skip to content

Instantly share code, notes, and snippets.

View adelarsq's full-sized avatar
🐒
I may be really slow to respond.

Adelar da Silva QueirΓ³z adelarsq

🐒
I may be really slow to respond.
View GitHub Profile
@Sheepolution
Sheepolution / main.lua
Last active May 7, 2025 09:32
Basic Luasteam P2P example
local server = true -- Change to false for the client
local connectionId
local pollGroup
Steam = require "luasteam"
Steam.init()
-- We call this to let Steam know that we want to use the networking sockets API.
-- Which probably won't do much in this example, but it can save you a delay.
@MariaSolOs
MariaSolOs / builtin-compl.lua
Last active May 8, 2025 14:42
Built-in completion + snippet Neovim setup
---Utility for keymap creation.
---@param lhs string
---@param rhs string|function
---@param opts string|table
---@param mode? string|string[]
local function keymap(lhs, rhs, opts, mode)
opts = type(opts) == 'string' and { desc = opts }
or vim.tbl_extend('error', opts --[[@as table]], { buffer = bufnr })
mode = mode or 'n'
vim.keymap.set(mode, lhs, rhs, opts)
open Donald
open System.Data.Common
open System.Data.SQLite
open System.Threading.Tasks
open Giraffe
open Giraffe.ViewEngine
open FsToolkit.ErrorHandling
open Microsoft.AspNetCore.Builder
[<RequireQualifiedAccess>]
@RaafatTurki
RaafatTurki / hex_editor.lua
Last active January 18, 2025 07:46
proper hex editing in neovim
local xxd_dump_cmd = 'xxd -g 1 -u'
local xxd_cur_pos = nil
local function is_binary_file()
local filename = vim.fn.expand('%:t')
-- local basename = string.match(filename, "^[a-z]*$")
local binary_ext = { 'png', 'jpg', 'jpeg', 'out' }
local ext = string.match(filename, "%.([^%.]+)$")
if ext == nil and string.match(filename, '[a-z]+') then return true end
@gaoDean
gaoDean / autolist.lua
Last active August 16, 2022 08:29
Minimal automatic list continuing for ordered and unordered lists for nvim in Lua
M.autolist = function()
local preceding_line = vim.fn.getline(vim.fn.line(".") - 1)
if preceding_line:match("^%s*%d+%.%s.") then
local list_index = preceding_line:match("%d+")
print(list_index .. "t")
vim.fn.setline(".", preceding_line:match("^%s*") .. list_index + 1 .. ". ")
vim.cmd([[execute "normal \<esc>A\<space>"]])
elseif preceding_line:match("^%s*%d+%.%s$") then
vim.fn.setline(vim.fn.line(".") - 1, "")
elseif preceding_line:match("^%s*[-+*]") and #preceding_line:match("[-+*].*") == 1 then
#r "nuget:FParsec"
open FParsec
type AttackVector =
| Network
| AdjacentNetwork
| Local
| Physical
@nikoloz-pachuashvili
nikoloz-pachuashvili / Money.fs
Last active July 15, 2022 14:25
Monetary value modeling in F#
namespace Domain
open System
open System.Runtime.CompilerServices
open System.Globalization
[<AutoOpen>]
module rec Money =
[<Struct;IsReadOnly>]
type Money = private Money of decimal * Currency with
@nojaf
nojaf / style.fsx
Created June 2, 2022 16:32
Compiling a Sass file using an F# script
#r "nuget: JavaScriptEngineSwitcher.ChakraCore.Native.win-x64"
#r "nuget: JavaScriptEngineSwitcher.ChakraCore, 3.18.2"
#r "nuget: DartSassHost, 1.0.0-preview7"
#r "nuget: FSharp.Control.Reactive, 5.0.5"
open System
open System.IO
open DartSassHost
open DartSassHost.Helpers
open JavaScriptEngineSwitcher.ChakraCore
@mrpmorris
mrpmorris / app.css
Created May 20, 2022 09:12
The CSS I put in the top of every new web app
:root {
box-sizing: border-box;
}
*, ::before, ::after {
box-sizing: inherit;
}
html {
scroll-behavior: smooth;
}