Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
use strict;
use feature qw( say );
# Inspired by http://d.hatena.ne.jp/syou6162/20100708/1278577199
# state-emission HMM
# 状態遷移確率
# 品詞s_iから品詞s_jへ遷移する確率
my @a = ([0.3, 0.0, 0.4, 0.1, 0.2],
@gologo13
gologo13 / list.cpp
Created July 5, 2012 15:43
linked list in c++
/**
* Copyright (c) 2012, Yohei Yamaguchi.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
@gologo13
gologo13 / tree.c
Created July 7, 2012 14:24
printtree
/**
* Copyright (c) 2012, Yohei Yamaguchi.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
@gologo13
gologo13 / file0.txt
Last active August 29, 2015 13:57
ヘッダのカスタマイズや独自処理をしたいときの AFNetworking 2.0 の使い方 ref: http://qiita.com/gologo13/items/f36cb7208c15869888ca
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"https://hogehoge.api.com/user"
parameters:@{ @"user_id":@"hoge" }
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"res:%@", responseObject);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error:%@", error);
}];
@gologo13
gologo13 / file0.sh
Created May 24, 2014 17:00
Homebrewでインストールするパッケージ一覧 ref: http://qiita.com/gologo13/items/7399012f6d9811a6572b
## vim
brew install vim
## zsh
brew install zsh
brew install zsh-completions
# zsh で dircolor を使っている場合必要
brew install coreutils
## htop:メモリやプロセスの確認
@gologo13
gologo13 / file0.txt
Created May 31, 2014 21:11
Dockerコンテナ内にmysqlサーバを立てる ref: http://qiita.com/gologo13/items/1bdba6085ec79153bf1a
# DOCKER-VERSION 0.3.4
FROM centos:6.4
# ここは自由に変えてください
MAINTAINER Taro Tanaka
# パッケージインストール
RUN yum install -y mysql mysql-server
# mysqlサーバのセットアップ
@gologo13
gologo13 / file0.sh
Last active January 22, 2016 02:00
Dockerでホストとコンテナ間でのファイルコピー ref: http://qiita.com/gologo13/items/7e4e404af80377b48fd5
# コンテナIDを調べる
$ sudo docker ps
$ sudo docker cp <コンテナID>:/etc/my.cnf my.cnf
@gologo13
gologo13 / index.js
Created November 24, 2014 06:16
chat app. with redis pub/sub feature
"use strict";
var redis = require('redis');
// constant
var CONST = {
type: {
JOIN: 0,
MESSAGE: 1
}
@gologo13
gologo13 / a.js
Last active January 23, 2022 06:05
Circular dependency problem and its solutions for node.js
"use strict";
var B = require('./b');
var A = module.exports = (function() {
var id, bInstance;
return {
init: function init(val) {
id = val;
@gologo13
gologo13 / file0.m
Last active August 29, 2015 14:20
Swift初心者を卒業するためのTips(enum編) ref: http://qiita.com/gologo13/items/0d484da7d4c9beb9e0b1
typedef NS_ENUM (NSUInteger, kIconSize) {
kIconSizeSmall,
kIconSizeMedium,
kIconSizeLarge,
kIconSizeOriginal
};