Skip to content

Instantly share code, notes, and snippets.

View ammarfaizi2's full-sized avatar
๐Ÿ€
Baby Opossum Posse

Ammar Faizi ammarfaizi2

๐Ÿ€
Baby Opossum Posse
View GitHub Profile
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2025 Ammar Faizi <[email protected]>
*
* http_logger.c - HTTP logger via LD_PRELOAD.
*
* gcc -Wall -Wextra -fpic -fPIC -Os http_logger.c -o /tmp/http_logger.so;
* export LD_PRELOAD=/tmp/http_logger.so;
* export GWNET_HTTP_LOG_FILE=/tmp/http.log;
* bash -c 'for i in {1..1000000}; do printf "POST /aaa HTTP/1.1\r\nHost: test.local\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nabcde\r\n0\r\n\r\n"; done | nc 127.0.0.1 8080';
// SPDX-License-Identifier: GPL-2.0-only
/*
* gwnet_http1.c - HTTP/1.0 and HTTP/1.1 parser.
*
* Copyright (C) 2025 Ammar Faizi <[email protected]>
*/
#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
// SPDX-License-Identifier: GPL-2.0-only
/*
* Author: Ammar Faizi <[email protected]>
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef PM_USE_TCP
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
static FILE *log_file = NULL;
static void init_log(void)
{
const char *log_path;
.section .rodata
msg_enter_pwd:
.string "Enter password: "
msg_pwd_wrong:
.string "Sorry, wrong password!"
msg_pwd_ok:
.string "\nPassword OK!"
msg_fmt_flag:
.string "Congratulations, you solved it!\nThe flag is: %s\n"
Recently, I saw an announcement that the mobile network in Bali will
be shut down during Nyepi.
What will happen to the servers in a data center in Bali?
Will they also go offline?
ChatGPT's response:
from matplotlib.ticker import ScalarFormatter
import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
import pandas as pd
from email.utils import format_datetime
from datetime import datetime, timezone, timedelta
import matplotlib.dates as mdates
import matplotlib.font_manager as fm
import requests
<?php
const MAIL_LOG_PATH = __DIR__."/users/ubuntu/gwmail/storage/gwmail-master/var/log/mail.log";
const BAN_LIST_PATH = __DIR__."/storage/mail_ip_ban_list.txt";
const IPSET_PATH = "/usr/sbin/ipset";
const FAIL_THRESHOLD = 200;
const CHECK_INTERVAL_SECS = 120;
const CIDR_PRECISION = 24;
function grab_ban_list_map(string $path): array
#!/usr/bin/env php
<?php
// SPDX-License-Identifier: GPL-2.0-only
const LOCK_FILE = "/tmp/public_inbox.lock";
function clean_header_val(string $str): string
{
$ex = explode("\n", $str);
foreach ($ex as &$v)
<?php
const DB_HOST = "1.1.1.1";
const DB_USER = "1";
const DB_PASS = "1";
const DB_PORT = 3306;
const DB_NAME = "00002_indihome";
$g_user_hashtable = [];