Skip to content

Instantly share code, notes, and snippets.

View wayt's full-sized avatar

Maxime Ginters wayt

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
int main(int argc, char const *argv[]) {
struct addrinfo hints;
struct addrinfo *res, *tmp;
char host[256];

Keybase proof

I hereby claim:

  • I am wayt on github.
  • I am maxwayt (https://keybase.io/maxwayt) on keybase.
  • I have a public key ASBxTKSlWLnLkrJqhWzUbhVuyu_LR1jYxNseYCzyuN8uwgo

To claim this, I am signing this object:

# Open NERDTree if no file supplied at vim startup
function! StartUp()
if 0 == argc()
NERDTree
end
endfunction
autocmd VimEnter * call StartUp()
@wayt
wayt / app.go
Created July 5, 2016 09:26
JSON test binary
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
)
func main() {
package main
import (
"fmt"
"math/rand"
"net"
"os"
"time"
)
#! /bin/sh
# Script to bring a network (tap) device for qemu up.
# The idea is to add the tap device to the same bridge
# as we have default routing to.
# in order to be able to find brctl
PATH=$PATH:/sbin:/usr/sbin
ip=$(which ip)
if [ -n "$ip" ]; then
src/shared/libshared.a(TcpSocket.cpp.o):
0000000000005a48 s EH_frame0
0000000000005a98 s EH_frame1
0000000000003ff4 s GCC_except_table0
00000000000041f8 s GCC_except_table11
0000000000004210 s GCC_except_table12
0000000000004228 s GCC_except_table15
0000000000004254 s GCC_except_table18
0000000000004294 s GCC_except_table20
class Thread
{
public:
Thread(std::function<void(void)> &func) : _thread(func) {}
template<class T>
Thread(T& obj) : _thread(boost::bind(&T::run, &obj)) {}
void join() { _thread.join(); }
static void Sleep(unsigned int ms) { boost::this_thread::sleep(boost::posix_time::milliseconds(ms)); }
template<class Retour, class T, class I>
class Function<Retour(T, I)>
{
public:
Function() : _inner(NULL), _func(NULL) {}
virtual ~Function() { delete _inner; }
template<class U>
Function(U* obj) : _inner(NULL), _func(NULL) { _inner = new InnerClass<U>(obj); }
Function(Retour(*func)(T, I)) : _inner(NULL), _func(func) {}
#ifndef FUNCTION_H_
# define FUNCTION_H_
#include <cstdlib>
template<class T>
class Function
{
public:
Function() : _obj(NULL), _func(NULL) {}