Skip to content

Instantly share code, notes, and snippets.

PHP FFI - Using a C++ DLL with C bindings with MinGW-64

Requirements

  • MinGW-64

Setup

On Windows:

Creating a ASP.NET Core Web API from scratch

Requires .NET 8 SDK

dotnet new sln -o MyApi
cd MyApi

dotnet new webapi -o MyApi
@haerulmuttaqin
haerulmuttaqin / ApiClient.java
Created December 25, 2018 18:50
Android CRUD Tutorial | • RETROFIT • PHP • MYSQL (https://youtu.be/Vh92eSAEu5c)
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
private static final String BASE_URL = "http://your-domain-name.000webhostapp.com/";
private static Retrofit retrofit;
public static Retrofit getApiClient() {
@wqweto
wqweto / mdAesCtr.bas
Last active August 14, 2025 12:52
[VB6/VBA] Simple AES 256-bit password protected encryption
'--- mdAesCtr.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0) Or (TWINBASIC <> 0)
'=========================================================================
' API
'=========================================================================
@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
@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 / 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
@mazhar-ansari-ardeh
mazhar-ansari-ardeh / SamplePrint.cs
Last active November 15, 2025 10:31
A sample code that demonstrates document printing with C#
class SamplePrint
{
public bool Print(string printer)
{
if(string.IsNullOrEmpty(printer))
return false;
bool ret = false;
try
{
import java.awt.Color;
import java.io.IOException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.jfree.fx.FXGraphics2D;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
@andrewabest
andrewabest / CreateCertificateAuthorityCert.bat
Last active November 2, 2021 06:29
Create a cert authority and client certificate for development using makecert.exe
:: Courtesy of http://www.digitallycreated.net/Blog/38/using-makecert-to-create-certificates-for-development
:: To see what certificates you currently have on your PC, open MMC (Run->mmc.exe), click "File->Add/Remove Snap-in", select Certificates from the left list, click "Add". Select "My user account", which will mean the snapin will show certificates that are stored specifically for your Windows user account. Select Certificates from the list again and "Add" it, then this time select "Computer account". This snapin will show certificates belonging to the machine specifically, and will apply across all accounts. Press Finish, then OK. I suggest you Save this MMC arrangement, so you can get back to it more easily in the future (File->Save).
:: Expand "Certificates (Local Computer)\Trusted Root Certification Authorities\Certificates". This folder shows you all the Certificate Authorities that your computer trusts.
:: So now we need to create our own Certificate Authority certificate. Open the Visual Studio