Skip to content

Instantly share code, notes, and snippets.

@oxnz
oxnz / makefile
Created January 11, 2013 13:19 — forked from antmd/makefile
all:commonprefix
clean:
rm *.o urlchanger
CC=clang
CFLAGS+=-O0 -g
CXXFLAGS+=-O0 -g
@oxnz
oxnz / bsd_get_mac.c
Created September 18, 2013 06:42
get mac addr
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <net/if_dl.h>
#include <net/if_types.h>
@oxnz
oxnz / blueutil.m
Created September 21, 2013 15:04
os x bluetooth util to change and refer bluetooth power state
/*
* blueutil
* Command-line utility to control Bluetooth.
* Uses private API from IOBluetooth framework (i.e. IOBluetoothPreference*()).
* http://www.frederikseiffert.de/blueutil
*
* This software is public domain. It is provided without any warranty whatsoever,
* and may be modified or used without attribution.
*
* Written by Frederik Seiffert <ego@frederikseiffert.de>
@oxnz
oxnz / dispatcher.py
Created September 21, 2013 16:17
python pcap dispatcher
#!/usr/bin/env python
#coding=utf-8
import struct
import sys
fp = open(sys.argv[1], 'rb')
data = fp.read()
pcap_header = {}
@oxnz
oxnz / tinep2p.py
Created September 26, 2013 12:54
#Python语言: 传说中只用了十五行Python语句的P2P客户端/服务端
#zz from http://www.exonsoft.com/~kochin/TinyP2P/tinyp2p.html
# tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)
# (C) 2004, E.W. Felten
# license: http://creativecommons.org/licenses/by-nc-sa/2.0
# Annotated by Kochin Chang, Jan. 2005
@oxnz
oxnz / daemon.py
Created October 1, 2013 09:58
daemonize
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
@oxnz
oxnz / manifest.xml
Created October 1, 2013 17:39
Autostart an application at bootup
in AndroidManifest.xml (application-part):
<receiver android:enabled="true" android:name=".BootUpReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
#include <stdio.h>
#include <stdlib.h>
/* The following include files for the network interface. */
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
\documentclass[a4paper, 12pt]{book}
\usepackage[colorlinks,linkcolor=blue,anchorcolor=blue,citecolor=green,CJKbookmarks=true]{hyperref}
\usepackage{fontspec,xltxtra,xunicode}
\usepackage{xeCJK}
\setCJKmainfont[BoldFont={STHeiti},ItalicFont={STKaiti}]{STSong}
\setmainfont{Times New Roman}
\setCJKsansfont[BoldFont={STHeiti}]{STXihei}
\setsansfont{Helvetica}
\setCJKmonofont{STFangsong}
\setmonofont{Courier New}
LDFLAGS = -framework IOKit -framework ApplicationServices
test: test.m