Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Focusing

Faraz Fallahi fffaraz

🚀
Focusing
View GitHub Profile
View gcd_prob.cpp
#include <iostream>
#include <random>
#include <bits/stdc++.h>
using namespace std;
int main()
{
std::random_device m_device{};
std::mt19937 m_generator{m_device()};
View telegram_emojis.cpp
#include <QCoreApplication>
#include <QFile>
#include <QDataStream>
#include <QDebug>
#include <iostream>
namespace Ui {
namespace Emoji {
constexpr auto kPostfix = 0xFE0FU;
class One {};
View pull.sh
#!/bin/bash
while true; do git pull; sleep 30; done
View keybase.md

Keybase proof

I hereby claim:

  • I am fffaraz on github.
  • I am fffaraz (https://keybase.io/fffaraz) on keybase.
  • I have a public key ASB--MPs8LCDbwPJOxCnVZ0kxuv-x93mHx4oo3bBLS9hIwo

To claim this, I am signing this object:

View FileAlterationMonitor.php
<?php
class FileAlterationMonitor
{
private $scanFolder, $initialFoundFiles;
public function __construct($scanFolder)
{
$this->scanFolder = $scanFolder;
$this->updateMonitor();
@fffaraz
fffaraz / bomb.php
Created Jul 5, 2017
How to defend your website with ZIP bombs
View bomb.php
<?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 / gof.html
Created Jul 4, 2017
Conway's Game of Life
View gof.html
<!-- saved from http://www.cc.gatech.edu/grads/b/bhroleno/ -->
<html>
<title>Conway's Game of Life</title>
<head>
<style type="text/css">
body{ font-family: serif; font-size:1.00em; text-align: center; margin: 10px 0 30px 0; virtical-align: middle }
</style>
<script type="text/javascript">
var cells = new Array(40);
var tmpCells = new Array(40);
@fffaraz
fffaraz / qt-unix-signals.md
Created May 22, 2017 — forked from azadkuh/qt-unix-signals.md
Catch Unix signals in Qt applications
View qt-unix-signals.md

Unix signals in Qt applications

It's quite easy to catch unix signals in Qt applications. you may like to ignore or accept them.

#include <QCoreApplication>

#include <signal.h>
#include <unistd.h>
@fffaraz
fffaraz / bs4.py
Created Nov 25, 2016
Python YouTube Playlist Link Collector
View bs4.py
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 / portscanner.c
Last active Aug 15, 2021
Port scanner code in c
View portscanner.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;