This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * g++ -std=c++11 netmon.cc -lpthread | |
| */ | |
| #include <linux/rtnetlink.h> | |
| #include <netdb.h> | |
| #include <net/if.h> | |
| #include <netinet/ip_icmp.h> | |
| #include <unistd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // -std=c99 | |
| #ifndef __cplusplus | |
| #include <stdbool.h> | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <time.h> | |
| #define PIPE_PROGRESS_SIZE 4096 | |
| #define min(a, b) \ | |
| ({ \ | |
| __typeof__(a) _a = (a); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generative Programming: Methods, Techniques and Applications | |
| // Ch.8 Static Metaprogramming in C++ | |
| #include <iostream> | |
| using namespace std; | |
| template <int i> | |
| struct aStatement { | |
| enum { n = i }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <set> | |
| #include <algorithm> | |
| #include <ctime> | |
| #include <iostream> | |
| const int UNASSIGNED = 0; | |
| const int N = 9; | |
| class Grid { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| #define TABLESIZE 5 | |
| // Linked List | |
| typedef struct node { | |
| char *data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // g++ % -lboost_system -lpthread $(pkg-config --libs openssl) | |
| #include "boost/asio.hpp" | |
| #include "boost/asio/ssl.hpp" | |
| #include <string> | |
| using namespace boost::asio; | |
| int main(int argc, char *argv[]) { | |
| io_service service; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * extract-multipart.cc | |
| * | |
| * This program extracts multipart messages from raw HTTP captures into | |
| * individual files. | |
| * | |
| * Usage: a.out <file ...> | |
| */ | |
| #include <iostream> | |
| #include <fstream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| ''' | |
| Inspired by: | |
| * http://weeklybuild.com/2014/07/07/mjpeg-bottle-gstreamer/ | |
| * http://www.ridgesolutions.ie/index.php/2014/11/24/streaming-mjpeg-video-with-web2py-and-python/ | |
| * https://gist.github.com/n3wtron/4624820 | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Detect file opening with LD_PRELOAD | |
| * | |
| * gcc -shared -fPIC inspect_open.c -o inspect_open.so -ldl | |
| * LD_PRELOAD=$PWD/inspect_open.so gnome-calculator | |
| * | |
| * See: | |
| * https://www.tomaz.me/2014/01/08/detecting-which-process-is-creating-a-file-using-ld-preload-trick.html | |
| * | |
| */ |