Skip to content

Instantly share code, notes, and snippets.

View lucamauri's full-sized avatar

Luca Mauri lucamauri

View GitHub Profile
@lucamauri
lucamauri / Fail2Ban.json
Last active March 12, 2021 15:38
Fail2Ban format description for LNav utility
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"fail2ban_log": {
"title": "Fail2Ban Actions Log",
"description": "The log that summarizes the actions of Fail2Ban application.",
"url": "https://www.fail2ban.org/",
"multiline": false,
"regex": {
"f2b-found": {
"pattern": "(?<timestamp>.*) (?<module>fail2ban)\\.(?<feature>.*[^ ])[ \\t]+\\[.*\\]\\: (?<level>.*[^ ])[ \\t]+.* \\[(?<service>.*)\\] (?<action>Found) (?<host>\\S+)"
Dim Options = New JsonWriterOptions
With options
.Indented = True
End With
Dim MemStream As New MemoryStream
Dim Writer As New Utf8JsonWriter(MemStream, Options)
Writer.WriteStartObject()
@lucamauri
lucamauri / BasicJSON.vb
Created August 14, 2020 08:44
VB.net examples with System.Text.Json
Dim Options = New JsonWriterOptions
With options
.Indented = True
End With
Dim MemStream As New MemoryStream
Dim Writer As New Utf8JsonWriter(MemStream, Options)
Writer.WriteStartObject()
@lucamauri
lucamauri / TimeL.wiki
Last active April 19, 2020 13:48
<time> tag generator for wikitext
Uses #timel function and <time> tag to generate human- and machine-readable date and time strings
@lucamauri
lucamauri / TemplateExample.lua
Last active April 19, 2020 09:26
LUA module to automatically create example of a template in MediaWiki
local p = {} --p stands for package
function p.TemplateExample(frame)
local SubPageName
local SubPageTitle
local Title
local Content
local pre = mw.html.create('pre')
local DoubleLF = string.char(10) .. string.char(10)
@lucamauri
lucamauri / WidgetComment
Created November 12, 2017 21:29
Visual Studio surround widget with comment
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.1.0">
<Header>
<Title>Widget comment</Title>
<Author>Luca Mauri</Author>
<Shortcut>WidComm</Shortcut>
<Description>Wrap a code widget in a customized HTML comment</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@lucamauri
lucamauri / 0_reuse_code.js
Created May 12, 2017 21:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lucamauri
lucamauri / MainPrompt.vb
Last active January 14, 2016 22:37
Template for a prompt module in VB.net
Module MainPrompt
Public Const PromptSymbol As String = "TLA > "
Public Const ApplicationTitle As String = "Short name of the application"
Sub Main()
Dim Statement As String
Dim BrokenDownStatement As String()
Dim Command As String
Dim Args As String()
Dim Result As String
@lucamauri
lucamauri / SysUpTime.vb
Created January 14, 2016 17:01
VB.net Uptime report
Public Class SysUpTime
Public ReadOnly Property ErrorInResult As Boolean
Public ReadOnly Property ErrorDetails As String
Public ReadOnly Property LastStartup As DateTime
Get
Return DateTime.Now.Subtract(_UpTimeSpan)
End Get
End Property
Public ReadOnly Property UpTimeString As String
@lucamauri
lucamauri / Luhn.net
Last active January 14, 2016 23:47
Check digit Luhn
Public Function Luhn(StringToCheck As String) As String
Dim CurrDigit As Integer
Dim TotalCounter As Integer
Dim DoubleDigit As Integer
TotalCounter = 0
For i = StringToCheck.Length To 1 Step -1
Try
CurrDigit = Integer.Parse(StringToCheck(i - 1))