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
<?php
if (!isset($_GET["key"]) || $_GET["key"] !== "secure your endpoint") {
http_response_code(403);
exit(0);
}
header("Content-Type: text/plain");
$ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER["REMOTE_ADDR"] ?? "";
echo file_get_contents("https://freedns.afraid.org/dynamic/update.php?your_key=x&address=".urlencode($ip));
// SPDX-License-Identifier: GPL-2.0-only
/*
* tc-nat.c - A simple NAT implementation using BPF.
*
* Copyright (C) 2023 Muhammad Aldin Setiawan <[email protected]>
* Copyright (C) 2023 Ammar Faizi <[email protected]>
*/
#include <linux/if_ether.h>
#include <linux/pkt_cls.h>
#include <linux/types.h>
#include <iostream>
#include "tdx.h"
namespace tgbot {
void clean_pending_requests(Tdx *tdx)
{
td_api::object_ptr<td_api::processChatJoinRequests> r;
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2023 Ammar Faizi <[email protected]>
*/
class GWRouter {
parse_title(body)
{
let m = body.match(/<title>(.*?)<\/title>/s);
if (m)
#include <ares.h>
#include <ares_dns.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <threads.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2023 Ammar Faizi <[email protected]>
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <fcntl.h>
static int get_cur_inode_state(struct send_ctx *sctx, u64 ino, u64 gen,
u64 *send_gen, u64 *parent_gen)
{
int ret;
int left_ret;
int right_ret;
u64 left_gen;
u64 right_gen;
struct btrfs_inode_info info;
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path)
{
struct btrfs_root *root = fs_info->dev_root;
struct btrfs_trans_handle *trans;
struct btrfs_device *device;
struct block_device *bdev;
struct super_block *sb = fs_info->sb;
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
struct btrfs_fs_devices *seed_devices;
u64 orig_super_total_bytes;