Skip to content

Instantly share code, notes, and snippets.

@goog
goog / iconv_practice.cpp
Last active September 11, 2015 10:24 — forked from suapapa/iconv_practice.cpp
iconv utf8 to ucs2 example
#include <stdio.h>
#include <iconv.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
int conv_utf8_to_ucs2(const char* src, size_t len)
{
iconv_t cb = iconv_open("UTF-16", "UTF-8");
if (cb == (iconv_t)(-1))
@goog
goog / showif.c
Last active August 29, 2015 14:28 — forked from OrangeTide/showif.c
example to list network interfaces on linux/bsd/osx/etc
/* showif.c : PUBLIC DOMAIN - Jon Mayo - August 22, 2006
* - You may remove any comments you wish, modify this code any way you wish,
* and distribute any way you wish.*/
/* finds all network interfaces and shows a little information about them.
* some operating systems list interfaces multiple times because of different
* flags, modes, etc. if you want to use this code you should be aware that
* duplicate interfaces is a possibility */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#