Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fffaraz's full-sized avatar
🚀
Focusing

Faraz Fallahi fffaraz

🚀
Focusing
View GitHub Profile
@fffaraz
fffaraz / pull.bat
Last active December 23, 2022 18:54
git pull
@echo off
for /d %%D in (*) do (
cd %%D
echo %%D
git pull
cd..
)
@fffaraz
fffaraz / gcd_prob.cpp
Created June 6, 2021 04:30
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()};
@fffaraz
fffaraz / telegram_emojis.cpp
Created June 6, 2021 04:26
telegram_emojis.cpp
#include <QCoreApplication>
#include <QFile>
#include <QDataStream>
#include <QDebug>
#include <iostream>
namespace Ui {
namespace Emoji {
constexpr auto kPostfix = 0xFE0FU;
class One {};
@fffaraz
fffaraz / pull.sh
Created September 24, 2018 20:03
Git pull
#!/bin/bash
while true; do git pull; sleep 30; done
@fffaraz
fffaraz / keybase.md
Created April 2, 2018 19:00
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:

@fffaraz
fffaraz / FileAlterationMonitor.php
Created January 12, 2018 21:38
FileAlterationMonitor
<?php
class FileAlterationMonitor
{
private $scanFolder, $initialFoundFiles;
public function __construct($scanFolder)
{
$this->scanFolder = $scanFolder;
$this->updateMonitor();
@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 / gof.html
Created July 4, 2017 21:23
Conway's Game of Life
<!-- 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 21:36 — forked from azadkuh/qt-unix-signals.md
Catch Unix signals in Qt applications

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 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?'):