Skip to content

Instantly share code, notes, and snippets.

View mmmunk's full-sized avatar

Thomas Munk mmmunk

View GitHub Profile
@mmmunk
mmmunk / Create.txt
Created May 24, 2019 08:36
64-bit WAMP (Windows, Apache, MariaDB/MySQL, PHP) til udvikling/test
64-bit WAMP (Windows, Apache, MariaDB/MySQL, PHP) til udvikling/test
====================================================================
Webserver med PHP
-----------------
Opret C:\WAMP
Opret C:\WAMP\www
Download nyeste Apache binary (httpd 2.4) VC15 Win64 fra https://www.apachelounge.com/download/
@mmmunk
mmmunk / helper.c
Created February 19, 2019 10:49
Example of creating and using a Windows DLL with MinGW
// x86_64-w64-mingw32-gcc -Wall -shared -O2 -s -o helper.dll helper.c
#include <stdio.h>
#include <string.h>
__declspec(dllexport) __stdcall int proc_sql_modify(char *sql, int size) {
strcpy(sql, "NEW SQL HERE");
return 0;
}
@mmmunk
mmmunk / MariaDB test-server.txt
Last active October 23, 2020 08:30
Nem opsætning af simpel/slank MariaDB test-server på Windows
Nem opsætning af simpel/slank MariaDB test-server på Windows
------------------------------------------------------------
Hent seneste stable MariaDB til Windows
(ZIP-fil uden debug-symbols, ikke MSI)
fra https://downloads.mariadb.org/
Der oprettes en valgfri rod-mappe
@mmmunk
mmmunk / RubberExample.cs
Last active February 13, 2019 13:46
C# .NET apps without Visual Studio
using System;
using System.Drawing;
using System.Windows.Forms;
public class RubberExample : Form {
bool mouseDown = false;
Point mouseDownPoint = Point.Empty;
Point mousePoint = Point.Empty;

Command 'x86_64-w64-mingw32-gcc' not found, but can be installed with:

64-bit exe: sudo apt install gcc-mingw-w64-x86-64

32-bit exe: sudo apt install gcc-mingw-w64-i686

type
TRefCountObject = class(TObject)
protected
ExtraReferencesCount: Integer; { Default 0 }
public
procedure Free;
function GetReference: TRefCountObject;
end;
procedure TRefCountObject.Free;
@mmmunk
mmmunk / RunProcessAndCaptureOutput.pas
Last active May 14, 2018 11:28
Delphi procedure to run an external command line program and capture and display the output.
procedure RunProcessAndCaptureOutput(const CmdLine: string; Memo: TMemo; HideLinesCount: Integer = 0);
var
SecAttr: TSecurityAttributes;
PipeR, PipeW: THandle;
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
Buffer: packed array[0..4096-1] of AnsiChar;
Count: Cardinal;
S, Leftover: AnsiString;
i, P: Cardinal;
@mmmunk
mmmunk / Client.dpr
Last active March 25, 2020 17:03
Base principles for Indy Server and Client in Delphi (with extra clients in other frameworks too)
program Client; {$APPTYPE CONSOLE}
uses
Windows, SysUtils, IdTCPClient;
var
TcpClient: TIdTCPClient;
S: string;
begin
-- Log incoming SQL on MySQL server:
set global log_output=FILE;
set global general_log_file="C:/Test/MySQL.log";
set global general_log=1;
-- Turn off:
set global general_log=0;
@mmmunk
mmmunk / generate-text.py
Created January 6, 2017 13:18
Generate some non-lorem-ipsum random text to use for tests
# fold -s -w 70
import sys
import random
cons = 'bcdfghjklmnpqrstvwxz'
consx = 'hjqvwx'
vows = 'aeiouy'
cvless = 'qxyz'
def generate_word(cap):