Skip to content

Instantly share code, notes, and snippets.

Avatar

rongyi rongyi

View GitHub Profile
View .tern-project
{
"libs": [
"browser",
"underscore",
"jquery"
],
"plugins": {
"node": {}
}
}
View print environ using C
#include <unistd.h>
#include <stdio.h>
extern char **environ;
int main()
{
int i = 0;
while(environ[i]) {
printf("%s\n", environ[i++]);
@rongyi
rongyi / backtrace example
Created Mar 31, 2014
how to print backtrace in C, remember add gcc option '-rdynamic' when compile
View backtrace example
#include <execinfo.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#define BACKTRACE_SIZE 256
static void
View gist:6102334
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/ethtool.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
#include <string.h>
#include <errno.h>
@rongyi
rongyi / gist:6101910
Created Jul 29, 2013
get iface index
View gist:6101910
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/ethtool.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
#include <string.h>
#include <errno.h>
@rongyi
rongyi / check iface
Created Jul 26, 2013
check network interface status
View check iface
#include <stdio.h>
#include <stdlib.h>
#include <linux/sockios.h>
#include <linux/ethtool.h>
#include <stdint.h>
#include <sys/types.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
@rongyi
rongyi / simple_snake_demo.c
Created Dec 16, 2012
a short snake demo for a douban friend
View simple_snake_demo.c
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
static void direction_up(void);
static void direction_down(void);
static void direction_left(void);
static void direction_right(void);
static void direction_up(void)
You can’t perform that action at this time.