Skip to content

Instantly share code, notes, and snippets.

@hadashiA
hadashiA / gist:4353436
Last active September 2, 2016 05:50
launch instance for knife-ec2
#USAGE: knife ec2 server create (options)
# -Z, --availability-zone ZONE The Availability Zone
# -A, --aws-access-key-id KEY Your AWS Access Key ID
# -K SECRET, Your AWS API Secret Access Key
# --aws-secret-access-key
# --user-data USER_DATA_FILE The EC2 User Data file to provision the instance with
# --bootstrap-version VERSION The version of Chef to install
# -N, --node-name NAME The Chef node name for your new node
# --server-url URL Chef Server URL
@hadashiA
hadashiA / version_1.cc
Created January 20, 2013 16:23
固定サイズのメモリアロケータ
#include <stdlib.h>
#include <cstddef>
class NextOnFreeList {
public:
NextOnFreeList *next;
};
class Rational {
public:
@hadashiA
hadashiA / mysql41.rb
Last active September 23, 2016 07:01
require 'formula'
class Mysql41 < Formula
homepage 'http://download.softagency.net/MySQL/Downloads/MySQL-4.1/'
url 'http://download.softagency.net/MySQL/Downloads/MySQL-4.1/mysql-4.1.22.tar.gz'
version '4.1.22'
md5 '37b4479951fa0cf052269d27c41ca200'
depends_on 'readline'
@hadashiA
hadashiA / version_2.cc
Last active December 11, 2015 10:28
固定サイズのメモリアロケータ2 (好きなクラスを扱える)
#include <stdlib.h>
#include <cstddef>
template <typename T>
class MemoryPool {
public:
MemoryPool(size_t size=EXPANSION_SIZE) {
ExpandTheFreeList(size);
}
require 'formula'
class Mysql40 < Formula
homepage 'http://mirror.provenscaling.com/mysql/community/source/4.0/'
url 'http://mirror.provenscaling.com/mysql/community/source/4.0/mysql-4.0.25.tar.gz'
version '4.0.25'
sha1 '65315c7659c75fcc9f3d9f749dbed26581f6da9c'
depends_on 'readline'
@hadashiA
hadashiA / version_3.cc
Created January 28, 2013 15:58
可変長のメモリアロケータ (再利用は未サポート…)
#include <stdlib.h>
#include <cstddef>
class MemoryChunk {
public:
MemoryChunk(MemoryChunk *next_chunk, size_t req_size)
: next_(next_chunk),
chunk_size_(req_size > DEFAULT_CHUNK_SIZE ? req_size : DEFAULT_CHUNK_SIZE),
bytes_already_allocated_(0) {
#include <iostream>
#include <sstream>
#include <string>
#include <v8.h>
using namespace std;
int main(int argc, const char **argv) {
// Create a scope and environment
v8::HandleScope scope;
@hadashiA
hadashiA / gist:4700931
Created February 3, 2013 08:14
ミスタードリラーのブロックの色
うすい:#F4D6E0 [244, 214, 224]
こい:#DE7699 [222, 118, 153]
うすい:#CCE9F9 [204, 233, 249]
こい:#4CBAEB [76, 186, 235]
@hadashiA
hadashiA / gist:4966452
Created February 16, 2013 11:08
std::function を使ったイベントハンドラ
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <string>
typedef int EventType;
struct Event {
public:
@hadashiA
hadashiA / file0.txt
Created March 3, 2013 13:26
サーバー/クライアント両方を javascript(coffee-script)で書くときのビルド設定 ref: http://qiita.com/items/808cdf082c74bfe6a0ce
.
├── Gruntfile.coffee
├── README.md
├── app.coffee
├── component.json
├── lib
├── package.json
├── public
│   ├── css
│   ├── img