Skip to content

Instantly share code, notes, and snippets.

@odan
odan / xampp_php7_xdebug.md
Last active July 25, 2024 23:01
Installing Xdebug for XAMPP
@odan
odan / nginx-php-windows-setup.md
Last active July 23, 2024 06:07
Nginx and PHP Setup on Windows

Nginx and PHP Setup on Windows

For local development you could also use Nginx with PHP as an replacement for XAMPP.

Install Nginx

@odan
odan / mssql-schema-dump.md
Last active June 29, 2024 15:13
Automate Your Database Schema Scripting with C# and SMO

Exporting SQL Server database structure into SQL script files

Scripting your SQL Server database schema is one such task that can benefit significantly from automation. Using C# and SQL Server Management Objects (SMO), you can easily generate scripts for your database schema and data.

Automating database scripting ensures that your schema and data scripts are always up-to-date and reduces the risk of human error. It is particularly useful for version control, backups, and migration tasks.

By integrating it into your workflow, you can significantly enhance your database management processes.

@odan
odan / php-oracle.md
Last active May 30, 2024 21:28
XAMPP - Oracle Driver Setup (v12)
@odan
odan / unbloat.bat
Last active May 12, 2024 12:25
Remove Windows Bloatware
@echo off
winget list
winget uninstall "Solitaire & Casual Games"
winget uninstall "Microsoft Kontakte"
winget uninstall "Movies & TV"
winget uninstall "News"
winget uninstall "Get Help"
winget uninstall "Microsoft People"
@odan
odan / mysq_uuid_v4.md
Last active May 10, 2024 15:31
Generating UUID v4 in MySQL

Generating UUID v4 in MySQL

SELECT
  LOWER(
    CONCAT(
      # 1th and 2nd block are made of 6 random bytes
      HEX(RANDOM_BYTES(4)),
      '-',
 HEX(RANDOM_BYTES(2)),
@odan
odan / remove-namespaces-xml.php
Last active March 29, 2024 09:34
Remove all namespaces from XML in PHP (dirty hack)
<?php
$dom = new DOMDocument();
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML(file_get_contents(__DIR__ . '/demo.xml'));
$dom = removeAllNamespaces($dom);
$dom->save('demo-out.xml');
using System;
using System.Collections.Generic;
using System.Globalization;
// CultureInfo culture = new CultureInfo("en-US");
// Full-date notation as defined by RFC 3339, section 5.6, for example, 2024-03-28
string date1 = string.Format("{0:yyyy}-{0:MM}-{0:dd}", DateTime.Now);
Console.WriteLine(date1);
@odan
odan / soap-xmldsig.md
Created June 1, 2021 14:23
Sign SOAP messages with xmlseclibs

Sign SOAP messages with xmlseclibs

Requirements

  • PHP 7.4+
  • OpenSSL

Generating Public and Private Keys

First we have to create a private key for signature creation, and a public key for verification.