- $ gem install oauth
- Go Twitter Application Management ( https://apps.twitter.com ) to get Consumer Key and Consumer Secret for your app.
- Fill 'TwitterApp_Consumer_Envvar.sh' with these values.
- $ source TwitterApp_Consumer_Envvar.sh
- Use 'TwitterApp_Authorize.rb' to get Access Token and Access Toke Secret.
- Fill 'TwitterApp_AccessToken_Envvar.sh' with these values .
- $ source TwitterApp_AccessToken_Envvar.sh
- See 'TwitterApp_GetFavs.rb' as an usage of 'TWITTER_XXXX' environment variables.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define_finalizer and undefine_finalizer | |
class Hoge | |
attr_accessor :name, :val | |
# Ref.: | |
# http://ruby-doc.org/core-2.3.0/ObjectSpace.html | |
# http://docs.ruby-lang.org/ja/2.3.0/method/ObjectSpace/m/define_finalizer.html | |
def initialize(n, v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Section "InputClass" | |
Identifier "Trackpoint Wheel Emulation" | |
MatchIsPointer "true" | |
MatchProduct "TrackPoint|DualPoint Stick|PS/2 Generic Mouse" | |
MatchDevicePath "/dev/input/event*" | |
Option "Emulate3Buttons" "true" | |
Option "EmulateWheel" "true" | |
Option "EmulateWheelButton" "2" | |
Option "XAxisMapping" "6 7" | |
Option "YAxisMapping" "4 5" |
- Files used:
- Stanford Bunny (http://graphics.stanford.edu/data/3Dscanrep/)
- Lenna (http://www.cs.cmu.edu/~chuck/lennapg/lenna.shtml)
$ time lz4c bun_zipper.ply
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aligned_ptr.rb | |
require 'fiddle' | |
ALLOCSIZE = 777 | |
ALIGNMENT = 128 | |
mem_r = Fiddle::Pointer.malloc(ALLOCSIZE + ALIGNMENT) | |
addr_r = mem_r.to_i | |
addr_a = (addr_r + ALIGNMENT - 1) & ~(ALIGNMENT - 1) | |
mem_a = Fiddle::Pointer.new(addr_a, ALLOCSIZE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable | |
/* Ref.: http://www.fixstars.com/en/opencl/book/sample/ */ | |
__kernel void hello(__global char* string) | |
{ | |
string[0] = 'H'; | |
string[1] = 'e'; | |
string[2] = 'l'; | |
string[3] = 'l'; | |
string[4] = 'o'; | |
string[5] = ','; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'opencl' | |
OpenCL.load_lib('/System/Library/Frameworks/OpenCL.framework/OpenCL') | |
cl_platforms_buf = ' ' * 4 | |
# Platform | |
OpenCL.clGetPlatformIDs(1, cl_platforms_buf, nil) | |
cl_platform = cl_platforms_buf.unpack("L")[0] | |
# Devices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <OpenGL/OpenGL.h> | |
#include <OpenGL/gl3.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
CGLContextObj ctx; | |
CGLPixelFormatObj pix; | |
GLint npix; | |
int attribs[] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# | |
# opengl-bindings | |
# * http://rubygems.org/gems/opengl-bindings | |
# * http://github.com/vaiorabbit/ruby-opengl | |
# | |
require 'opengl' | |
require 'glfw' | |
OpenGL.load_lib() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ref.: | |
# http://www.redblobgames.com/grids/hexagons/ | |
# http://www.redblobgames.com/grids/hexagons/implementation.html | |
class Hex | |
attr_accessor :q, :r, :s | |
def initialize(q, r, s = -q - r) | |
@q = q |