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
$ vi .zshrc | |
+ export PATH=/usr/local/bin:/usr/local/sbin:$PATH | |
$ source .zshrc | |
$ echo $PATH | |
/usr/local/bin:/usr/local/sbin:/usr/bin:... |
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
# Node.jsをHomebrewから入れる | |
$ brew install node | |
# NPM(Node Package Manager)を入れる | |
$ sudo curl http://npmjs.org/install.sh | sh | |
# 環境変数を設定する(Zshの場合) | |
$ vi .zshrc | |
+ export NODE_PATH=/usr/local/lib/node_modules | |
$ source .zshrc |
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
// UIActionSheetクラスを作成する | |
// cancelButtonとdestructiveButtonはどちらかをnilにしておく | |
UIActionSheet *sheet; | |
sheet = [[UIActionSheet alloc] initWithTitle:@"写真選択" | |
delegate:self | |
cancelButtonTitle:@"キャンセル" | |
destructiveButtonTitle:nil | |
otherButtonTitles:@"カメラ", @"ライブラリ", nil]; | |
[sheet showInView:self.view]; |
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
$ vi ~/.ssh/config | |
+ Host gitolite | |
+ HostName ***.***.***.*** | |
+ User git | |
+ Port **** | |
+ IdentityFile ~/.ssh/gitolite |
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
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
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
server { | |
listen ****; #8080とか8001とか | |
server_name ****; | |
# Root | |
location / { | |
root /usr/local/www/; | |
index index.html index.htm; | |
if (-f $request_filename) { | |
expires 30d; |
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
server { | |
listen ****; # 80番以外の競合しないポート | |
server_name blog.hifumi.info; | |
client_max_body_size 20M; | |
# Root | |
location / { | |
root /usr/local/www/wordpress; | |
index index.html index.htm index.php; | |
if (-f $request_filename) { |
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
// Inspired by http://stackoverflow.com/questions/540345/how-do-you-load-custom-uitableviewcells-from-xib-files | |
#import <UIKit/UIKit.h> | |
@interface BaseCell : UITableViewCell | |
/* Load Cell-Object from Nib-Name */ | |
+ (BaseCell*)cellFromNibNamed:(NSString *)nibName; | |
@end |
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
""" | |
Three ways of computing the Hellinger distance between two discrete | |
probability distributions using NumPy and SciPy. | |
""" | |
import numpy as np | |
from scipy.linalg import norm | |
from scipy.spatial.distance import euclidean | |
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
import numpy as np | |
import numpy.random as rand | |
import matplotlib.pyplot as plt | |
def mixture_gaussian(i): | |
pi_0 = 0.3 | |
if rand.random() < pi_0: | |
return rand.normal(-5, 1) | |
else: |
OlderNewer