Skip to content

Instantly share code, notes, and snippets.

@yang-wei
yang-wei / openshift.md
Last active June 24, 2016 14:07
Open shift npm start

##Openshift pitfall during deployment

###MongoDB address

###Marker Files By default, openshift will start our nodejs application by running supervisor server.js. However we might want to do more(like testing, transform) any changed file when starting our application. For example, our scripts field in package.json looks like this.

"scripts": {
ORG 8000H ; 開始番地
LD SP, 0D000H ; D000番地の内容をSPに転送
LD HL, 0 ; HLに0を転送
LD B, 2 ; BOOO番地の内容を足す回数
LOOP: PUSH BC ; 残りの繰り返す回数をスタックに記憶
CALL KEISAN ; KEISANへ分岐
DEC B ; レジスタBの値から1を引いて、残りの回数
JP NZ, LOOP ; 残りの回数が0かどうか
JP KAKUNO ; 残りの回数が0なら、KAKUNOへ分岐
KEISAN: POP DE ; 残りの回数をスタック上に転送 
ORG 7000H ;プログラム開始番地
KURIKAE: LD C,30H ;SWO-7のI/Oアドレス指定
IN A, (C) ;SWO-7からデータの入力
OUT (11H), A ;入力データをLEDに出力
CP AA ;奇数スイッチがON
JP Z,OWARI ;Yes -> サブルーチンを終了
JP KURIKAE ;No -> データ入力を繰り返す
OWARI: NOP ;ブレークポイントの位置
END ;
ORG 7000H ; プログラムの開始番地
;メインプログラム
MAIN: LD BC,(8F14H) ; 音の長さを設定
CALL OTODASU ; OTODASUへ分岐する
CALL FUYASU ; FUYASUへ分岐する
JP MAIN ; 新しい長さおよび高さで鳴らす
;WAITサブルーチン
WAIT: CPD ; 待ち時間(音の高さ)を減らす
JP PE,WAIT ; 待ち時間(音の高さ)が0になるまでWAITを繰り返す
RET ; 0になると、サブルーチンから戻る
ORG 8000H ; プログラム開始番地
LD A, 0A000H ; 入力値をAレジスタに転送
ADD A,8000H ; Aレジスタの内容に80Hを加算
SRA A ; Aレジスタを算術右シフト演算
SLA A ; Aレジスタを算術左シフト演算
SCF ; キャリーの補数を1にする
ADC A,07H ; Aレジスタに07Hおよびキャリーフラグの値を加算
AND 00F0H ; Aレジスタを00F0Hとの AND論理積
SET 7,A ; Aレジスタのビット7を1にする
RES 1,A ; Aレジスタのビット1を0にする
@yang-wei
yang-wei / minimal
Created April 13, 2015 02:07
Minimal vim setting
execute pathogen#infect()
syntax on
filetype plugin indent on
set nocompatible " Be iMproved
set tabstop=2
set expandtab
set softtabstop=2
set shiftwidth=2
set smarttab
@yang-wei
yang-wei / README.md
Last active August 29, 2015 14:21
npm publish useful thing

To publish a package

npm publish ./

Beta version

npm publish ./ --tag beta
// to install
npm install pkname@beta
@yang-wei
yang-wei / README.md
Created August 11, 2015 13:47
Fix vagrant "Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available." error

So one day you start you VM and this error came out:

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
@yang-wei
yang-wei / guide.md
Created October 8, 2015 12:49
mysql import and export
@yang-wei
yang-wei / phpbrew-config.md
Created October 28, 2015 04:44
How to use switch PHP(using phpbrew) version in nginx config
php -v
PHP 5.6.3 (cli) (built: Oct 28 2015 09:47:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

But this only changes in CLI. You have to tweak you nginx(same for apache) to make it works. Nginx will still using the native PHP-FPM.

> ps aux | grep php-fpm