Skip to content

Instantly share code, notes, and snippets.

View namazso's full-sized avatar
😂
👌

namazso

😂
👌
View GitHub Profile
@namazso
namazso / cx_compile_time_unix.hpp
Created July 10, 2017 05:01
Get the compilation time in unix time
namespace cx
{
constexpr bool cx_strcmp_part(const char* const a, const char* const b)
{
return *b ? (*a == *b && cx_strcmp_part(a + 1, b + 1)) : true;
}
constexpr unsigned month_str_to_int(const char* const str)
{
@namazso
namazso / blake2sp.c
Created July 10, 2019 16:55
Portable single .h + .c BLAKE2sp implementation
// Public domain
// Based on public domain 7zip implementation by Igor Pavlov and Samuel Neves
#include "blake2sp.h"
// Set this if your processor is unaligned little endian
#define LITTLE_ENDIAN_UNALIGNED
#ifdef LITTLE_ENDIAN_UNALIGNED
#define GetUi32(p) (*(const uint32_t *)(const void *)(p))
@namazso
namazso / monstercat_gold_downloader.ps1
Last active December 15, 2019 05:01
Monstercat Gold mass downloader
# use https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/ for making cookies.txt
# downloading as zip is broken at the time of writing, therefore per-track downloading is used.
# getting tracks for all releases is also broken at the time, so releases without catalog id
# are still downloaded as zips because you can get zips without the track ids or catalog id.
$format = "flac";
$args = @{
skip=0
limit=50
@namazso
namazso / diskid32.cpp
Created January 15, 2020 17:20
DiskId32 updated, fixed, modernized
// diskid32.cpp - display the details of hard drives in a command window
//
// Modernized version that compiles under VS2019 by namazso at 2020-01-15
// Additional fixes and changes:
// - Rewrote MAC address part to not crash on 0 NICs and support 16+ NICs
// - Removed "ComputerId" and the relevant primitive hash method and parts
//
// 06/11/00 Lynn McGuire written with many contributions from others,
// IDE drives only under Windows NT/2K and 9X,
// maybe SCSI drives later
@namazso
namazso / prompt.cpp
Last active January 9, 2021 19:16
win32 text prompt box, like MessageBox but for text
INT_PTR PromptText(const wchar_t* title, wchar_t* text, size_t len)
{
__pragma(pack(push, 1)) struct alignas(DWORD)
{
DLGTEMPLATE hdr{
WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER,
0,
1,
100,

Keybase proof

I hereby claim:

  • I am namazso on github.
  • I am namazso (https://keybase.io/namazso) on keybase.
  • I have a public key ASAB6RagHlmZBRr9h2lYD9mgZWpfuNbycSbRksuCeQ1SaQo

To claim this, I am signing this object:

@namazso
namazso / irc_format.cpp
Created October 15, 2021 03:29
IRC formatting parser
#include <string>
#include "irc_format.h"
struct IRCParser
{
enum State : int
{
Normal,
Color1_1,
Color1_2,
@namazso
namazso / flags.asm
Created December 15, 2021 07:25
get/set RFLAGS with perfect unwinding
.code
getflags PROC FRAME
pushfq
.pushreg rax
.endprolog
.beginepilog
pop rax
ret
getflags ENDP
@namazso
namazso / settings.json
Created February 22, 2022 09:20
MSYS2 in Windows terminal
{
"commandline": "cmd /c \"set MSYSTEM=MINGW32 && set LOGINSHELL=bash && C:\\msys64\\usr\\bin\\bash.exe --login\"",
"name": "MSYS2 MinGW 32-bit",
"icon": "C:\\msys64\\mingw32.ico"
},
{
"commandline": "cmd /c \"set MSYSTEM=MINGW64 && set LOGINSHELL=bash && C:\\msys64\\usr\\bin\\bash.exe --login\"",
"name": "MSYS2 MinGW 64-bit",
"icon": "C:\\msys64\\mingw64.ico"
},
@namazso
namazso / coff.ksy
Created January 13, 2022 20:41
Kaitai Struct YAML for COFF
meta:
id: coff
title: Common Object Format File
file-extension:
- obj
license: CC0-1.0
ks-version: 0.9
endian: le
doc-ref: https://wiki.osdev.org/COFF
seq: