Skip to content

Instantly share code, notes, and snippets.

View ximik777's full-sized avatar

Grigoriy Stratov ximik777

View GitHub Profile
@ximik777
ximik777 / ares.c
Created October 30, 2015 12:09
static gethostbyname with libcares
#include <ares.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
@ximik777
ximik777 / async_dns.c
Created October 30, 2015 00:03 — forked from mopemope/async_dns.c
c-ares example
#include <ares.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
<?php
// Ab PHP 5.4 steht für json_encode die Konstante JSON_PRETTY_PRINT zur Verfügung.
echo json_encode($arr, JSON_PRETTY_PRINT);
// Für PHP <= 5.3 gibt es folgende Alternative (Quelle Zend):
/**
* Pretty-print JSON string
*
@ximik777
ximik777 / hash.c
Last active August 29, 2015 14:10 — forked from tonious/hash.c
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;