Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Focusing

Faraz Fallahi fffaraz

🚀
Focusing
View GitHub Profile
@fffaraz
fffaraz / config.py
Created Aug 23, 2016 — forked from bonzanini/config.py
Twitter Stream Downloader
View config.py
consumer_key = 'your-consumer-key'
consumer_secret = 'your-consumer-secret'
access_token = 'your-access-token'
access_secret = 'your-access-secret'
View tcpserver.go
package main
import (
"io"
"log"
"net"
"os"
"runtime"
)
@fffaraz
fffaraz / dns.c
Created May 29, 2016
DNS Query Code in C with linux sockets
View dns.c
//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
View daemon.txt
// http://www.crankyotaku.com/2016/04/linux-programming-daemon-basics.html
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
View git-streak.sh
#!/bin/bash
current="Thu Dec 25 00:00:00 2014"
counter=9126
while [ $counter -le 9140 ]; do
export GIT_AUTHOR_DATE="$current +0000"
export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
git commit --allow-empty -m "$counter"
View doping.sh
#!/bin/bash
ping -c5 speedtest-nyc1.digitalocean.com
ping -c5 speedtest-nyc2.digitalocean.com
ping -c5 speedtest-nyc3.digitalocean.com
ping -c5 speedtest-ams1.digitalocean.com
ping -c5 speedtest-ams2.digitalocean.com
ping -c5 speedtest-ams3.digitalocean.com
ping -c5 speedtest-sfo1.digitalocean.com
ping -c5 speedtest-sgp1.digitalocean.com
ping -c5 speedtest-lon1.digitalocean.com
View lsniffer.c
/*
Packet sniffer using libpcap library
*/
#include<pcap.h>
#include<stdio.h>
#include<stdlib.h> // for exit()
#include<string.h> //for memset
#include<sys/socket.h>
#include<arpa/inet.h> // for inet_ntoa()
View TCP-Packet-Injection.c
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<features.h>
#include<linux/if_packet.h>
#include<linux/if_ether.h>
#include<errno.h>
#include<sys/ioctl.h>
#include<net/if.h>
#include<net/ethernet.h>
@fffaraz
fffaraz / tr4_ll.c
Created Nov 12, 2015
TCP/ICMP/UDP traceroute
View tr4_ll.c
/* Copyright (C) 2012-2015 P.D. Buchan (pdbuchan@yahoo.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@fffaraz
fffaraz / math_unsigned.h
Created Oct 13, 2015
Arbitrary-precision integer arithmetic in C++
View math_unsigned.h
#ifndef MATH_UNSIGNED_H
#define MATH_UNSIGNED_H
#include <cstdint>
#include <vector>
#include <iostream>
#include <stdexcept>
#include <algorithm>
#include <sstream>
#include <cctype>