Skip to content

Instantly share code, notes, and snippets.

View fffaraz's full-sized avatar
🚀
Focusing

Faraz fffaraz

🚀
Focusing
View GitHub Profile
@fffaraz
fffaraz / dns.c
Created May 29, 2016 05:58
DNS Query Code in C with linux sockets
//DNS Query Program on Linux
//Author : Silver Moon (m00n.silv3r@gmail.com)
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
@fffaraz
fffaraz / benchmark.cpp
Last active June 8, 2026 00:26
Memory Benchmark
// g++ -O3 -std=c++17 benchmark.cpp -o benchmark
#include <iostream>
#include <vector>
#include <chrono>
#include <iomanip>
#include <cstdint>
#include <string>
#include <sstream>
#include <random>
@fffaraz
fffaraz / bs4.py
Created November 25, 2016 20:21
Python YouTube Playlist Link Collector
from bs4 import BeautifulSoup
import requests
def getPlaylistLinks(url):
sourceCode = requests.get(url).text
soup = BeautifulSoup(sourceCode, 'html.parser')
domain = 'https://www.youtube.com'
for link in soup.find_all("a", {"dir": "ltr"}):
href = link.get('href')
if href.startswith('/watch?'):
@fffaraz
fffaraz / resources.md
Last active December 14, 2025 11:14
CS 306 - Linux/UNIX Programming
@fffaraz
fffaraz / FizzBuzz.cpp
Last active September 5, 2025 02:33
FizzBuzz leetcode
// https://leetcode.com/problems/fizz-buzz/
class Solution {
public:
const char* fizzbuzz[4] = { nullptr, "Fizz", "Buzz", "FizzBuzz" };
const uint8_t pattern[15] = { 3, 0, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 0, 0 };
vector<string> fizzBuzz(int n)
{
vector<string> result(n);
for (int i = 1, m = 1; i <= n; ++i, ++m) {
@fffaraz
fffaraz / bomb.php
Created July 5, 2017 20:41
How to defend your website with ZIP bombs
<?php
// https://blog.haschek.at/2017/how-to-defend-your-website-with-zip-bombs.html
// dd if=/dev/zero bs=1M count=10240 | gzip > 10G.gzip
$agent = lower($_SERVER['HTTP_USER_AGENT']);
//check for nikto, sql map or "bad" subfolders which only exist on wordpress
if (strpos($agent, 'nikto') !== false || strpos($agent, 'sqlmap') !== false || startswith($url,'wp-') || startswith($url,'wordpress') || startswith($url,'wp/'))
{
sendBomb();
@fffaraz
fffaraz / portscanner.c
Last active July 31, 2024 17:57
Port scanner code in c
#include "stdio.h"
#include "sys/socket.h"
#include "errno.h"
#include "netdb.h"
#include "string.h"
#include "stdlib.h"
int main(int argc , char **argv)
{
struct hostent *host;
@fffaraz
fffaraz / ipv6guide.md
Created June 7, 2024 02:15 — forked from timothyham/ipv6guide.md
A Short IPv6 Guide for Home IPv4 Admins

A Short IPv6 Guide for Home IPv4 Admins

This guide is for homelab admins who understand IPv4s well but find setting up IPv6 hard or annoying because things work differently. In some ways, managing an IPv6 network can be simpler than IPv4, one just needs to learn some new concepts and discard some old ones.

Let’s begin.

First of all, there are some concepts that one must unlearn from ipv4:

Concept 1

@fffaraz
fffaraz / projects.md
Last active May 9, 2024 18:11
Project Ideas List

http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/

Text

Reverse a String Enter a string and the program will reverse it and print it out.

Pig Latin Pig Latin is a game of alterations played on the English language game. To create the Pig Latin form of an English word the initial consonant sound is transposed to the end of the word and an ay is affixed (Ex.: "banana" would yield anana-bay). Read Wikipedia for more information on rules.