Skip to content

Instantly share code, notes, and snippets.

View lucamauri's full-sized avatar

Luca Mauri lucamauri

View GitHub Profile
@lucamauri
lucamauri / WOL.net
Created December 22, 2013 21:49
A complete class implementing Wake On LAN feature in native .NET
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class clsWOL
Const lenHeader As Integer = 6
Const lenMAC As Integer = 6
Const repMAC As Integer = 16
Dim mEndPoint As IPEndPoint
@lucamauri
lucamauri / CIN Calculator
Created December 22, 2013 21:56
This module compute the bank account checksum known as CIN
Module modCIN
Friend Const CINLetters As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ-. "
Friend Const CINDigits As String = "0123456789"
Friend Const Divisor As Integer = 26
Friend CINEvenList As Integer() = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28}
Friend CINOddList As Integer() = {1, 0, 5, 7, 9, 13, 15, 17, 19, 21, 2, 4, 18, 20, 11, 3, 6, 8, 12, 14, 16, 10, 22, 25, 24, 23, 27, 28, 26}
Function CalcCIN(ByVal ABI As String, ByVal CAB As String, ByVal Account As String) As String
@lucamauri
lucamauri / MD4 Visual Basic .net
Created December 22, 2013 22:03
This class calculate MD4 checksum
'Copyright (c) 2000 Oren Novotny (osn@po.cwru.edu)
'Permission is granted to use this code for anything.
'Derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm.
'http://www.rsasecurity.com">RSA Data Security, Inc.</a> requires
'attribution for any work that is derived from the MD4 Message-Digest
'Algorithm; for details see <a href="http://www.roxen.com/rfc/rfc1320.html">
'RFC 1320</a>.
'This code is ported from Norbert Hranitzky's
'(norbert.hranitzky@mchp.siemens.de)
@lucamauri
lucamauri / Images from website
Created December 22, 2013 22:04
Check and download images from website
Imports System.Net
Imports System.IO
Module modImages
Function getimages() As Boolean
Dim prefixFull As String = "http://www.yoursite.com/images/"
Dim prefixShort As String = "http://www.yoursite.com"
Dim basePath As String = "c:\your path here"
Dim imgClient As WebClient
@lucamauri
lucamauri / Text file manipulator
Created December 22, 2013 22:07
A collection of three simple class that allow you to read files from disk and from internet and write a stream back to a file. It is a simple task for a programmer, but it may comes in hand from time to time to have it ready-to-use.
Imports System.IO
Imports System.Text
Imports System.Net
Module modText
Function textFromInternet(ByVal address As String) As StringBuilder
Dim Request As WebRequest
Dim Response As WebResponse
Dim Reader As StreamReader
Dim Line As String
@lucamauri
lucamauri / Query WHOIS
Created December 22, 2013 22:17
Query WHOIS databases for data on domain names
Public Class clsWhoIs
Public Enum registry
whois_arin_net = 0
whois_ripe_net = 1
whois_apnic_net = 2
End Enum
Function test(ByVal ipAddress As String, ByVal queryTo As registry) As String
Dim tcpc As New TcpClient()
Dim strDomain As String
Dim arrDomain As Byte()
@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))
@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 / 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 / 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