Skip to content

Instantly share code, notes, and snippets.

@jpzhu
jpzhu / gist:6150495
Created August 4, 2013 14:27
ELF relocation
http://blog.csdn.net/zirconsdu/article/details/8170078
http://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/
http://eli.thegreenplace.net/2011/08/25/load-time-relocation-of-shared-libraries/
@jpzhu
jpzhu / apt-get install list
Last active December 20, 2015 19:09
ubuntu tool
sudo apt-get install git-core vim aptitude ssh
sudo apt-get install g++ gcc automake build-essential
sudo apt-get install g++-multilib gcc-multilib
sudo apt-get install git-core exuberant-ctags minicom
sudo apt-get install curl tree tofrodos bison flex rpm2cpio
#Document:Help
sudo apt-get install make-doc bash-doc gcc-doc devhelp
sudo apt-get install doxygen graphviz freemind
sudo apt-get install gperf curl xsltproc libxml2-utils
@jpzhu
jpzhu / vid-ctrl.c
Created August 8, 2013 02:49
video for linux 2, v4l. v4l2 demo code.
#include <linux/videodev2.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int i, ctrl, fd = open(argc > 1 ? argv[1] : "/dev/video0", O_RDWR);
if(fd < 0) {
perror("open failed");
@jpzhu
jpzhu / ffmpeg
Created August 22, 2013 02:11
ffmpeg ffplay mencoder
从一个视频流中截取中间一段。
ffmpeg -ss 00:30:00 -t 00:00:05 -i orginalfile -vcodec copy -acodec copy newfile
@jpzhu
jpzhu / jni.md
Last active December 21, 2015 22:29
android java jni

Andoird 中使用了一种不同传统Java JNI的方式来定义其native的函数。
其中很重要的区别是Andorid使用了一种Java 和 C 函数的映射表数组,并在其中描述了函数的参数和返回值。这个数组的类型是JNINativeMethod,定义如下:

typedef struct {
    const char* name;
    const char* signature;
    void* fnPtr;
} JNINativeMethod;

第一个变量name是Java中函数的名字。

@jpzhu
jpzhu / json.java
Created September 4, 2013 08:51
json android java
JSONArray response_out = null;
static JSONObject jObj = null;
private static final String API_REQUEST_CODE = "r";
private static final String API_SERVICE_CODE = "s";
private static final String API_RESPONSE_OUT = "o";
private static final String TAG_ID = "id";
private static final String TAG_CATEGORY = "category";
private static final String TAG_NAME = "name";
private static final String TAG_STREAM = "stream";
@jpzhu
jpzhu / player.java
Last active December 22, 2015 08:30
mp3 player android
import android.media.MediaPlayer;
//Create a MediaPlayer Object
MediaPlayer mMediaPlayer = new MediaPlayer();
//Prepare the data for player
//This take some time, maybe used in an asynctask()
// streami type could be "Uri" or "String"
@jpzhu
jpzhu / test.java
Created September 6, 2013 05:43
java test
package com.windriver.ps.test;
class example{
private int num;
void setNum(int n){ num = n;}
private int getNum(){ return num;}
public static void main(String args[]){
example ex = new example();
ex.num = 6;