Skip to content

Instantly share code, notes, and snippets.

@Noiled
Noiled / convert_map_jni.cpp
Created July 14, 2022 02:31 — forked from theeasiestway/convert_map_jni.cpp
Java HashMap to C++ std::map conversion and vice versa
jobject StlStringStringMapToJavaHashMap(JNIEnv *env, const std::map<std::string, std::string>& map) {
jclass mapClass = env->FindClass("java/util/HashMap");
if(mapClass == NULL)
return NULL;
jmethodID init = env->GetMethodID(mapClass, "<init>", "()V");
jobject hashMap = env->NewObject(mapClass, init);
jmethodID put = env->GetMethodID(mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
std::map<std::string, std::string>::const_iterator citr = map.begin();
@Noiled
Noiled / add-git-aliases.sh
Created October 11, 2021 02:31 — forked from ifduyue/add-git-aliases.sh
git aliases
#!/bin/bash
set -x
# common shortcuts
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.rb rebase
@Noiled
Noiled / atomic.h
Created December 4, 2019 10:07 — forked from aprell/atomic.h
Atomic read/write
#ifndef ATOMIC_H
#define ATOMIC_H
// Adapted from http://golubenco.org/2007/06/14/atomic-operations
/**
* @brief Atomic type
*/
typedef int atomic_t;
@Noiled
Noiled / ImageHelper.h
Created August 10, 2018 14:39 — forked from PaulSolt/ImageHelper.h
A simple UIImage to RGBA8 conversion function
/*
* The MIT License
*
* Copyright (c) 2011 Paul Solt, PaulSolt@gmail.com
*
* https://github.com/PaulSolt/UIImage-Conversion/blob/master/MITLicense.txt
*
*/
#import <Foundation/Foundation.h>
(NSString *) CreateTypeStringWithOSType(OSType inType); // ;-)
//
// CapoPlaybackButton.h
// Capo
//
// Created by Christopher Liscio on 9/22/10.
// Copyright (c) 2010 SuperMegaUltraGroovy. All rights reserved.
//
#import <UIKit/UIKit.h>
echo "install gas-preproccesor.pr"
git clone git://github.com/mansr/gas-preprocessor.git
echo "copy gas-preprocessor.pl to /usr/sbin"
sudo cp -f gas-preprocessor/gas-preprocessor.pl /usr/sbin/
echo "set execute right"
chmod +x /usr/sbin/gas-preprocessor.pl
echo "install finished."
#!/bin/sh
# directories
SOURCE="ffmpeg"
FAT="build-iOS"
SCRATCH="scratch"
# must be an absolute path
THIN=`pwd`/"thin"
@Noiled
Noiled / NSWeakTimer.m
Last active May 29, 2016 06:07 — forked from bendytree/NSWeakTimer.m
A starting point for an NSTimer that has a weak reference to its target. ARC only.
//
// NSWeakTimer.m
#import "NSWeakTimer.h"
@interface NSWeakTimerTarget : NSObject
@property (weak) id target;
@property (assign) SEL selector;
@property (assign) NSTimer* timer;
@Noiled
Noiled / gist:cb780af83eebc2cbaa262a638f191f8c
Created April 26, 2016 13:06 — forked from ka010/gist:235253db3fccfac53910
Convert an AVFrame to CVPixelbuffer
-(void)getPixelBuffer:(CVPixelBufferRef *)pbuf {
@synchronized (self) {
if(!_pFrame || !_pFrame->data[0])
return;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
// [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
// [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
@(_pFrame->linesize[0]), kCVPixelBufferBytesPerRowAlignmentKey,