Skip to content

Instantly share code, notes, and snippets.

Thomas Munk mmmunk

Block or report user

Report or block mmmunk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mmmunk
mmmunk / picdir-to-html.py
Last active May 15, 2020
Reads a directory of picture files and creates a single-file HTML-document including all the pictures as Base64 data inside the document
View picdir-to-html.py
# Reads a directory of picture files and creates a single-file HTML-document including all the pictures as Base64 data inside the document
import sys
import os
import io
import math
import base64
from PIL import Image, UnidentifiedImageError
# ---------- TagBuilder ----------
@mmmunk
mmmunk / WindowsBatchTipsTricks.cmd
Last active Oct 23, 2019
Tips & Tricks for Windows Batch files
View WindowsBatchTipsTricks.cmd
REM This file is not meant to be run in it's entirety
REM --- Check if script is run as administrator
net session >nul 2>&1
if %errorlevel% neq 0 (
echo This script must be run with administrator privileges
pause
exit /B
)
@mmmunk
mmmunk / Create.txt
Created May 24, 2019
64-bit WAMP (Windows, Apache, MariaDB/MySQL, PHP) til udvikling/test
View Create.txt
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 Feb 19, 2019
Example of creating and using a Windows DLL with MinGW
View helper.c
// 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
Created Feb 11, 2019
Nem opsætning af simpel/slank MariaDB test-server på Windows
View MariaDB test-server.txt
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 Feb 13, 2019
C# .NET apps without Visual Studio
View RubberExample.cs
using System;
using System.Drawing;
using System.Windows.Forms;
public class RubberExample : Form {
bool mouseDown = false;
Point mouseDownPoint = Point.Empty;
Point mousePoint = Point.Empty;
View C compiler for Windows on Ubuntu.md

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

sudo apt install gcc-mingw-w64-x86-64

View RefCountObject.pas
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
Delphi procedure to run an external command line program and capture and display the output.
View RunProcessAndCaptureOutput.pas
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 Mar 25, 2020
Base principles for Indy Server and Client in Delphi (with extra clients in other frameworks too)
View Client.dpr
program Client; {$APPTYPE CONSOLE}
uses
Windows, SysUtils, IdTCPClient;
var
TcpClient: TIdTCPClient;
S: string;
begin
You can’t perform that action at this time.