Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
nishinoshake / loop.js
Created July 31, 2016 14:38
シンプルなReactコンポーネントのループ
const LatestPostsComponent = props => {
const postPreviews = renderPostPreviews(props.posts);
return (
<section>
<div><h1>Latest posts</h1></div>
<div>
{ postPreviews }
</div>
</section>
@nishinoshake
nishinoshake / favicon.html
Last active July 27, 2016 10:18
faviconapple-touch-icon
<link rel="shortcut icon" href="/common/images/favicon.ico">
<link rel="icon" sizes="192x192" href="/common/images/android-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="/common/images/apple-touch-icon.png">
@nishinoshake
nishinoshake / readme.md
Last active January 8, 2017 07:36
AWSにCentOS7のインスタンスを生成した後にやること

Elastic IPの割り当て

CentOSに限った話じゃないけど。
Elastic IPから新しく割り当てを選択。
生成したインスタンスを選択すると割り当て完了。

sshコンフィグの設定

vi ~/.ssh/config

Host hoge

HostName hostname

@nishinoshake
nishinoshake / group.sh
Last active January 8, 2017 07:36
グループの作成と追加
# 作成
groupadd git
# 追加
# -a --append
# -G --groups
usermod -aG group user
# ユーザ作成時に追加
useradd -g group user
@nishinoshake
nishinoshake / readme.md
Last active July 27, 2016 13:31
リモートリポジトリの作成

SSHユーザをgit制限シェルで作成

adduser git-hoge -s /usr/bin/git-shell
passwd git-hoge

ベアリポジトリの作成

mkdir /var/www/git/hoge.git
cd /var/www/git/hoge.git
git init --bare --shared

gitユーザのみの読み書きに権限を変更

@nishinoshake
nishinoshake / nologin.sh
Created July 19, 2016 13:09
nologinのユーザにログインする
# ログインシェルを指定すればOK
su -s /bin/bash hoge
@nishinoshake
nishinoshake / how_to_sudo.sh
Created July 19, 2016 10:01
sudoをパイプやリダイレクトに効かせる
# ふつうにsudoしてリダイレクトすると
# コマンドに対してしかsudoしない
sudo ls > ls.txt
# コマンドをshでラップしてshにsudoすれば全体に効く
# 読みにくいけど
sudo sh -c "ls > ls.txt"
@nishinoshake
nishinoshake / mailman.sh
Created July 19, 2016 07:18
mailmanでよく使うコマンド
# メーリングリストの一覧表示
list_lists
# メーリングリストの新規作成
newlist [options] listname admin-addr admin-passwd
#メーリングリストの削除
rmlist -a listname
# メーリングリストのアドレス一覧表示
@nishinoshake
nishinoshake / readme.md
Last active July 10, 2016 13:38
Let's Encrypt
  1. gitクローン git clone https://github.com/letsencrypt/letsencrypt
  2. 必要なパッケージをインストール letsencrypt-auto --help
  3. 証明書を発行 ./letsencrypt-auto certonly --debug --webroot -w /var/www/html/hoge.jp -d hoge.jp