Skip to content

Instantly share code, notes, and snippets.

View incebellipipo's full-sized avatar
🐳

Emir Cem Gezer incebellipipo

🐳
View GitHub Profile
@incebellipipo
incebellipipo / git-status
Last active February 15, 2018 08:20
Git status wtih recursive depth search directory
#!/bin/bash
REPOSITORY_DIRS=$(find . -type d -name '.git' | xargs -n 1 dirname)
bold=$(tput bold)
normal=$(tput sgr0)
clean=true
for repo in $REPOSITORY_DIRS
@incebellipipo
incebellipipo / routingtableparser.cpp
Created August 3, 2018 08:31
/proc/net/route C++ parser
/* reads and parses /proc/net/route
*
* $ g++ routingtableparser.cpp -std=c++11
* should not require root priviledges
*
*/
#include <iostream>
#include <sstream>
#include <fstream>
@incebellipipo
incebellipipo / wpa_forker.cpp
Created August 3, 2018 08:36
Simple c++ code that detects interface changes
/*
* Detects interface plug or removal with given name, starts forks wpa_supplicant accordingly
* g++ wpa_forker.cpp -std=c++11 -lpthread
*
*/
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <csignal>
@incebellipipo
incebellipipo / json_dir_tree.cpp
Created August 3, 2018 08:40
Directory tree output in json format C++
/*
* $ sudo apt-get install libjsoncpp-dev
* $ g++ json_dir_tree.cpp -std=c++11 -ljsoncpp
* $ ./a.out $(pwd)
* Directory tree output in json format
*
*/
#include <jsoncpp/json/json.h>
#include <dirent.h>
@incebellipipo
incebellipipo / pingxx.cxx
Created August 4, 2018 16:10
Ping C++11 implementation
/*
* g++ pingxx.cxx -std=c++11 -lpthread
*/
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cerrno>
#include <cstring>
#include <thread>
@incebellipipo
incebellipipo / network-calculator.cpp
Created August 27, 2018 13:12
simple ip calculator
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <arpa/inet.h>
#include <getopt.h>
#include <sys/types.h>
static unsigned char short_opts[] = "i:n:";
static struct option long_options[] = {
@incebellipipo
incebellipipo / ip-management-with-netlink.cpp
Last active March 1, 2024 01:55
Simple IP management with netlink socket
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <iostream>
#include <cerrno>
#include <cstdlib>
#include <cstdio>