Skip to content

Instantly share code, notes, and snippets.

View wqweto's full-sized avatar

Vladimir Vissoultchev wqweto

View GitHub Profile
@wqweto
wqweto / mdExcel.bas
Last active November 5, 2020 18:26
Write to Excel using ADO
Option Explicit
Public Function ReadFromExcel( _
ByVal sFileName As String, _
Optional Workbook As String, _
Optional ByVal CsvHeader As Boolean) As Recordset
Dim cn As ADODB.Connection
Dim rsDest As Recordset
Dim sTable As String
Dim sCharset As String
@wqweto
wqweto / NumberToWords (Bulgarian)
Last active March 13, 2016 18:06
Конвертиране на число в словом с думи за VB.NET. По подразбиране работи за левове в мъжки род, но може да се използва и за мярка в женски род (например метро единици) или среден род (например евро)
Module ToWordsModule
Public Function ToWords(ByVal dblValue As Double, Optional Measure As Object = Nothing, Optional Gender As String = Nothing) As String
Dim vDigits As Object
Dim vGenderDigits As Object
Dim vValue As Object
Dim lIdx As Long
Dim lDigit As Long
Dim sResult As String = ""
Dim sString As New String("0", 18)
<log4net>
<appender name="Services.Debug" type="log4net.Appender.RollingFileAppender">
<file value="Logs/Services.Debug.log" />
<appendToFile value="true" />
<encoding value="utf-8" />
<maximumFileSize value="20MB" />
<maxSizeRollBackups value="4" />
<datePattern value="yyyyMMdd" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
@wqweto
wqweto / mdMain.bas
Created March 22, 2016 15:55
VB6 surrogate linker
Attribute VB_Name = "mdMain"
Option Explicit
'=========================================================================
' API
'=========================================================================
Private Const INVALID_FILE_ATTRIBUTES As Long = -1
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
@wqweto
wqweto / Program.cs
Last active October 3, 2016 09:34
Playing with the StackOverflow datasets : All the wrong ways
// https://ayende.com/blog/175618/playing-with-the-stackoverflow-datasets-all-the-wrong-ways?Key=57ee98e3-2865-47ba-bc68-367d694b2a6e
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
@wqweto
wqweto / program.cs
Last active August 1, 2023 08:31
Minimal .Net Web Server with Regex Routing in 177 LOC of C#
//
// Poor Man's Web Server with Regex Routing in 177 LOC of C#
//
// This is a simple standalone http server that handles routing with regular expressions
// matching. For each request the router passes capture groups to handlers as a data dictionary.
//
// Router implementation constructs a single composite regex to match request path, based on
// https://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html
//
// One can use `WebServer` and `Router` classes alone, just has to register all custom
@wqweto
wqweto / cVbzlib.cls
Created March 29, 2017 15:43
VB6 Deflate/Inflate with thunks
Option Explicit
'=========================================================================
' Thunk data
'=========================================================================
' Auto-generated on 29.3.2017 17:59:42, CodeSize=6048, DataSize=987, ALIGN_SIZE=16
Private Const STR_THUNK1 As String = _
"Vot0JAho/I8DAIsG/1AYi9CF0nUCXsOJVgSNSgK+AIAAAIPI/2aJQQJmiQFmiUH+g8EGTnXvV426BIADALn7AwAA86tmq1/HggCAAwAAAAAAx4L4jwMAAAAAALgBAAAAXsOQkJCQkJCQkJCQkJCQkItEJASLiACAAwCNDEmNFEhmi0xIAmaD+f90Dg+/yY0USWbHBFD//+sXZotSBGaD+v90DQ+/ymbHhEgEgAMA//+LiACAAwBXjRRJi0wkEGaJTFAEi5AAgAMAjRRSZsdEUAL//4uQAIADAGaLvEgEgAMAjRRSZok8UIuQAIADAGaLuACAAwCNFFIPvxRQZom8SASAAwCD+v9fdA+NDFJmi5AAgAMAZolUSAKLiACAAwCKVCQIiJQIAAADAIuIAIADAEGB4f9/AACJiACAAwDDkJCB7CgBAACLhCQsAQAAU1VWV4t4BIsAM/aLj/iPAwCJRCQ0hckPjv8AAACNh/KPAwCJRCQQi5wkRAEAAIvRK9YD" & _
"04P6Aw+MtgAAAIvejUQkKDPSK9iJXCQUjUQUKAPDO8F9C4tsJBAzwIoEKusWi6wkQAEAAIvaK9kD3jPAigQri1wkFIhEFChCg/oDfMuLTCQpi1wkKIHh/wAAAIvBweAFA8HB4AMrwYtMJCqB4f8AAACNFEmNFJKNFNLR4ivRi8uB4f8AAAADwovRweIIA9G59
@wqweto
wqweto / lm_main.lua
Last active January 17, 2018 15:05
Battle of the slowest - markdown parser 2.0
--
-- lm_main.lua - a simple markdown to html converter with some twists
--
-- original battle at http://forums.bgdev.org/index.php?showtopic=49993
--
local lpeg = require("lpeg")
local re = require("lpeg.re")
local esc_pattern = lpeg.Cs((lpeg.P"<"/"&lt;" + lpeg.P">"/"&gt;" + lpeg.P"&"/"&amp;" + 1)^0)
local function html_escape(text)
@wqweto
wqweto / UPrinter.cls
Last active September 15, 2018 18:52
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "UPrinter"
Attribute VB_GlobalNameSpace = False
IF OBJECT_ID('usp_adm_ScriptTableData') IS NOT NULL DROP PROC usp_adm_ScriptTableData
GO
------------------------------------------------------------------------------------------------------------------------------------------------
-- exec usp_adm_ScriptTableData 'nom_Contragents', 'Name LIKE ''%нап%''', 'NoteCUCDLULD', 1
-- exec usp_adm_ScriptTableData 'backupset', @ColumnNames=1, @ResetAuditInfo=1
-- exec usp_adm_ScriptTableData 'acc_Wizard', @ColumnNames=1, @ResetAuditInfo=1
-- exec usp_adm_ScriptTableData 'nom_Holidays', @ColumnNames=2, @ResetAuditInfo=0, @WhereClause='Year(Date)=2013', @OrderClause='Date'
CREATE PROC usp_adm_ScriptTableData (
@TableName SYSNAME