Skip to content

Instantly share code, notes, and snippets.

View geta6's full-sized avatar

geta6 geta6

View GitHub Profile
- (void)captureOutput:(AVCaptureOutput *)capture didOutputSampleBuffer:(CMSampleBufferRef)sample fromConnection:(AVCaptureConnection *)connection
{
CVImageBufferRef buffer = CMSampleBufferGetImageBuffer(sample);
CVPixelBufferLockBaseAddress(buffer, 0);
size_t width = CVPixelBufferGetWidth(buffer);
size_t height = CVPixelBufferGetHeight(buffer);
size_t bytesPerRow = CVPixelBufferGetBytesPerRow(buffer);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef cgContext = CGBitmapContextCreate(CVPixelBufferGetBaseAddress(buffer), width, height, 8, bytesPerRow, colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease(colorSpace);
@geta6
geta6 / git-prompt.zsh
Created October 17, 2012 15:29
Git-Prompt
#
# Git Prompt
#
__git_files() { _files }
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
@geta6
geta6 / git-prompt.zsh
Created October 17, 2012 15:29
Git-Prompt
#
# Git Prompt
#
__git_files() { _files }
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
@geta6
geta6 / biteArray.coffee
Created October 19, 2012 05:18
nodejsでバイトアレイを作るよー^O^ノ
Buffer.prototype.toByteArray = ->
Array.prototype.slice.call @, 0
@geta6
geta6 / divisor.coffee
Created October 23, 2012 03:00
greatest common divisor x and y
[x, y] = process.argv.slice 2, 4
unless x and y
console.log 'Usage [cmd] [x] [y]'
console.log 'return greatest common divisor x and y'
process.exit 1
while 0 isnt r = x%y
x = y; y = r
@geta6
geta6 / server.js
Created October 25, 2012 09:09
simplest HTTP test server
var http = require('http'), fs = require('fs'), url = require('url');
var server = {
root: '.',
port: 8080,
index: 'index.html'
};
http.createServer(function (req, res) {
var location = url.parse(req.url);
var path = server.root + '/' + server.index;
@geta6
geta6 / doc_about.html
Created October 29, 2012 07:50
Simple Server Sample
<h1>About</h1>
<p>This is simple server.</p>

How To Use

mkmfc.py

  • Wav -> RAW -> MFCC -> SIG
usage : python mkmfc.py
@geta6
geta6 / README.md
Created November 20, 2012 07:07
rename script

Rename Script

Requirement

  • zsh

Usage

  • target is current directory
@geta6
geta6 / configure_nginx.sh
Created December 2, 2012 16:01
Nginx configure options
apt-get install libpcre3-dev libssl-dev zlib1g-dev
./configure \
--prefix=/usr/local \
--conf-path=/usr/local/etc/nginx.conf \
--pid-path=/usr/local/var/run/nginx.pid \
--error-log-path=/usr/local/var/log/error.log \
--http-log-path=/usr/local/var/log/access.log \
--with-http_dav_module --with-http_mp4_module \
--with-http_secure_link_module --with-http_ssl_module \