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 / farsi.html
Created June 29, 2014 11:23
farsi.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p><textarea rows="15" cols="100" id="src"></textarea></p>
<p><textarea rows="15" cols="100" id="dest" dir="rtl"></textarea></p>
#include <iostream>
#include <string>
#include <vector>
#include <stdexcept>
#include <type_traits>
// The following is evil template "black magic". Only because we write it instead
// of the C++ standards committee. This first section is effectively a C++11
@fffaraz
fffaraz / index.php
Created July 10, 2014 09:23
php file listing
<table border="1">
<th><td>File</td><td>Size</td></th>
<?php
$files = scandir(".");
$i = 0;
foreach($files as $entry)
{
@fffaraz
fffaraz / procstat.h
Created November 15, 2014 05:59
/proc/%d/stat
struct StatStuff
{
int pid; // %d
char comm[256]; // %s
char state; // %c
int ppid; // %d
int pgrp; // %d
int session; // %d
int tty_nr; // %d
int tpgid; // %d
@fffaraz
fffaraz / regex.html
Created December 21, 2014 23:28
Regex Cheat Sheet
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Regex Cheat Sheet</title>
<style type="text/css">
body { font-family: verdana; font-size: smaller; }
h2 { margin-bottom: 3px; font-size: small; }
th { background-color:#f6f6f6; }
td.sc { text-align:center; font-weight:bold; font-size:xx-large; font-family:"courier new", courier; }
@fffaraz
fffaraz / ui512test.cpp
Created December 21, 2014 23:51
ui512test
#include <iostream>
#include <cstdint>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#if 0
@fffaraz
fffaraz / ghosttest.c
Created January 29, 2015 04:52
GHOST vulnerability tester
/* ghosttest.c: GHOST vulnerability tester */
/* Credit: http://www.openwall.com/lists/oss-security/2015/01/27/9 */
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
#include <iostream>
using namespace std;
int main()
{
for(long long i=1000000000; i <= 9999999999; i++)
{
long long a = i;
int x[10] = {};
@fffaraz
fffaraz / 1.cpp
Created June 5, 2015 20:38
C++ pthread
class C
{
public:
void *hello(void)
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
static void *hello_helper(void *context)