Skip to content

Instantly share code, notes, and snippets.

caojianhua caojianhua

Block or report user

Report or block caojianhua

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
caojianhua /
Created Dec 24, 2019
Rename file to create date from exif info
#! /usr/bin/env bash
for filename in ./*
tmp="$(echo "$filename" | tr '[A-Z]' '[a-z]')"
case "$filename" in
newname="$(exiftool -filemodifydate "$filename" | grep "File Modification Date/Time" | awk -F ': ' '{print $2}' | sed -e 's/\-[0-9][0-9]\:00//g' -e 's/\+[0-9][0-9]\:00//g' -e 's/:/-/g' -e 's/ /_/g').${filename##*.}"
echo "mv $filename to $newname"
mv "$filename" $newname
caojianhua /
Last active Nov 7, 2019
#! /bin/sh
# 获得输入的jar文件
# 这里直接使用dx命令,是因为我已经提前配置好了环境变量,dx目录位于:
# $ANDROID_HOME/sdk/build-tools/android-4.3.1/dx
dx --dex --verbose --no-strict --output=temp.dex $JAR_FILE > /dev/null
# 计算jar包中的方法数
caojianhua / OpenGLToCVPixelBuffer.m
Created Jan 27, 2016
Create CVPixelBufferRef from OpenGL
View OpenGLToCVPixelBuffer.m
@interface SREAGLContext : NSObject
+ (EAGLContext*)sharedContext;
+ (EAGLContext*)newContext: (EAGLRenderingAPI) api;
@implementation SREAGLContext
caojianhua / ImageToCVPixelBuffer.m
Last active Jun 10, 2017
Create CVPixelBufferRef from an UIImage
View ImageToCVPixelBuffer.m
+ (CVPixelBufferRef)pixelBufferFromImage:(UIImage *)image {
NSData * rawImageData = [UIImage RawRepresentation:image pixelFormat:SVPixelFormat_BGRA];
NSDictionary * attributes = @{
(NSString *)kCVPixelBufferIOSurfacePropertiesKey : @{},
(NSString *)kCVPixelBufferCGImageCompatibilityKey : @(YES),
(NSString *)kCVPixelBufferOpenGLESCompatibilityKey : @(YES),
(NSString *)kCVPixelBufferCGBitmapContextCompatibilityKey : @(YES),
caojianhua / MemoryToCVPixelBuffer.m
Created Dec 28, 2015
Create CVPixelBuffer from memory
View MemoryToCVPixelBuffer.m
CVPixelBufferRef pxbuffer = NULL;
CVPixelBufferCreateWithBytes(kCFAllocatorDefault,width,height,kCVPixelFormatType_32ARGB,data,4 * width, NULL, NULL, NULL, &pxbuffer);
CIImage* tmpImage = [CIImage imageWithCVPixelBuffer:pxbuffer];
UIImage* newImage = [UIImage imageWithCIImage:tmpImage];
dispatch_async(dispatch_get_main_queue(), ^{
imageView.image = newImage;
You can’t perform that action at this time.