Skip to content

Instantly share code, notes, and snippets.

View menjaraz's full-sized avatar

Menjanahary menjaraz

View GitHub Profile
use std::convert::Infallible;
use axum::{
async_trait,
extract::FromRequestParts,
http::{request::Parts, Request, header::CONTENT_LENGTH},
middleware::{from_fn, Next},
response::{Html, IntoResponse, IntoResponseParts, Response},
routing::get,
Router, body::{Full, self},
@menjaraz
menjaraz / golang.udl.xml
Created January 25, 2024 06:06 — forked from blinksmith/golang.udl.xml
Notepad++ Syntax Highlight for Go
<NotepadPlus>
<UserLang name="Golang" ext="go" udlVersion="2.1">
<!--
NPP Syntax Highlight for Go
using most used color in NPP for Golang.
Author: blinksmith Version: 0.1.3
Last tested in Notepad++ v7.5.9
Quick start :
Method 1
@menjaraz
menjaraz / app.d
Created January 24, 2024 09:48
nthPrime
import std.stdio: writefln;
import std.math : sqrt, log;
int popCount(int n)
{
n -= (n >>> 1) & 0x55555555;
n = ((n >>> 2) & 0x33333333) + (n & 0x33333333);
n = ((n >> 4) & 0x0F0F0F0F) + (n & 0x0F0F0F0F);
return (n * 0x01010101) >> 24;
@menjaraz
menjaraz / sqlite_static_cpp.md
Created November 21, 2023 06:41 — forked from payalord/sqlite_static_cpp.md
How to add SQLite into your VS project as Static Library

I assume that you already created C++ Win32 project where you want to include SQLite.

  1. Navigate to https://www.sqlite.org/download.html and download latest amalgamation source version of SQLite.
  2. Extract all the files into your project directory, or your include path, or separate path that you will add/added as include path in your project properties.
  3. Run Developer Command Prompt for VS **** which is usually available at Start -> Programs -> Visual Studio **** -> Visual Studio Tools.
  4. Navigate with command prompt to that directory where we extracted our SQLite.
  5. Run next command to compile: cl /c /EHsc sqlite3.c
  6. Run next command to create static library: lib sqlite3.obj
  7. Open properties of your project and add sqlite3.lib to Linker -> Input -> Additional Dependencies.
@menjaraz
menjaraz / build_sqlite3_lib.md
Last active November 21, 2023 03:43 — forked from zeljic/build_sqlite3_lib.md
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source

    For example: source https://www.sqlite.org/2023/sqlite-amalgamation-3440000.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2023/sqlite-dll-win64-x64-3440000.zip

  3. Extract both archives to the same directory

@menjaraz
menjaraz / app.d
Last active February 8, 2023 11:58
Project Euler Solution of Question 2
/*
* Project Euler Question 2
* Even Fibonacci numbers
* Link: https://projecteuler.net/problem=2
*
* Solution: 4_613_732
*/
import std.stdio, std.range, std.algorithm;
Version [HKCU/HKLM]\Software\
D4 Borland\Delphi\4.0
D5 Borland\Delphi\5.0
D6 Borland\Delphi\6.0
D7 Borland\Delphi\7.0
D2005 Borland\BDS\3.0
D2006 Borland\BDS\4.0
D2007 Borland\BDS\5.0
D2009 CodeGear\BDS\6.0
@menjaraz
menjaraz / UBox.pas
Created January 5, 2018 09:55 — forked from delphidabbler/UBox.pas
A generic Delphi class that can wrap any type in an object. Designed for use in wrapping value types and strings in objects. Extracted from my CodeSnip project (http://codesnip.delphidabbler.com/)
unit UBox;
interface
type
/// <summary>Generic class that wraps a type in an object.</summary>
/// <remarks>Although this type can be used to wrap any type it is aimed at
/// wrapping value types and strings.</remarks>
@menjaraz
menjaraz / ConvertStringToPAnsiChar.pas
Created January 5, 2018 09:32 — forked from bonjin6770/ConvertStringToPAnsiChar.pas
DelphiにおけるStringをPAnsiCharへ安全に変換する
function ConvertStringToPAnsiChar(str:string):PAnsiChar;
var
p:PAnsiChar;
begin
GetMem(p, Length(string) + 1);
System.AnsiStrings.StrPCopy(p, str);
Result := p;
end;
@menjaraz
menjaraz / Singleton.Example.pas
Created January 5, 2018 09:21 — forked from drgarcia1986/Singleton.Example.pas
Esqueleto para criação de uma classe Singleton em Delphi
unit Singleton.Example;
interface
type
TMyClass = class
strict private
class var FInstance : TMyClass;
private
class procedure ReleaseInstance();