Skip to content

Instantly share code, notes, and snippets.

View n1tehawk's full-sized avatar

NiteHawk n1tehawk

  • duschkumpane
  • Germany
View GitHub Profile
@n1tehawk
n1tehawk / WebDecompression.pas
Last active August 28, 2023 07:40
FreePascal helper unit to postprocess compressed response body
unit WebDecompression;
{$mode OBJFPC}
{
This is a FreePascal unit to help with postprocessing web server response
streams that are possibly compressed.
Note: Even if you want your program to work with the response in string form,
it's very easy to achieve this: simply use a `TStringStream`.
Standards-compliant web servers will indicate the compression used via the
"Content-Encoding: " header field in their reply. You have several ways of
@n1tehawk
n1tehawk / webhooks.pas
Created May 7, 2020 22:27
FreePascal unit to execute Discord webhooks
unit webhooks;
(*
A webhook is a simple way to post messages to channels in Discord, by sending
suitable JSON data via a POST request. You'll have to create the webhook first
(using API calls or administrative functions in Discord's UI) and retrieve its
specific URL that contains two distinct elements: the webhook ID and a token.
see e.g.
https://discordapp.com/developers/docs/resources/webhook#execute-webhook
@n1tehawk
n1tehawk / foobar.c
Created October 21, 2016 09:25
Dynamic symbol resolution from a static binary
/*
* Dynamic symbol resolution from a static binary:
*
* Windows: gcc -o foobar.exe -Wl,-export-all-symbols foobar.c && ./foobar
* Linux: gcc -o foobar -rdynamic -ldl foobar.c && ./foobar
*/
#ifdef _WIN32
#include <windows.h>
#else
#define _GNU_SOURCE