Skip to content

Instantly share code, notes, and snippets.

View ogaty's full-sized avatar

Yuji Ogata ogaty

View GitHub Profile
@ogaty
ogaty / curl.md
Last active November 3, 2018 01:35
curl
  • curl -A "USER_AGENT" http://www.example.com
  • curl -b cookie.txt(設定)
  • curl -c cookie.txt(保存)
  • curl -d data設定
  • curl -H request Header
  • curl -i header+HTML
  • curl -I headerのみ
  • curl -k ssl無視
  • curl -L redirect追従
  • curl -o ファイル保存
@ogaty
ogaty / uwp.md
Last active December 4, 2018 00:26
uwp戻るボタン
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; ;
SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
{
    if (Frame.CanGoBack)
    {
        Frame.GoBack();
        a.Handled = true;
    }
};
@ogaty
ogaty / bash256.sh
Created December 9, 2018 02:00
256 color bash
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
for fgbg in 38 48 ; do # Foreground / Background
for color in {0..255} ; do # Colors
@ogaty
ogaty / LS-COLORS.html
Last active December 9, 2018 02:10
ls colors
https://takamints.hatenablog.jp/entry/2014/11/02/173631
<div id="lscolors_sample" data-unlink="">
<div class="cell a01 c30 b47" style="width: 140px; float: left; text-align: center; border-bottom: 1px solid rgb(68, 68, 68); color: rgb(102, 102, 102); background-color: rgb(204, 204, 204);">文字色↓/背景色→</div><div class="cell a01 c30 b47" style="width: 60px; float: left; text-align: center; border-bottom: 1px solid rgb(68, 68, 68); color: rgb(102, 102, 102); background-color: rgb(204, 204, 204);">黒</div><div class="cell a01 c31 b47" style="width: 60px; float: left; text-align: center; border-bottom: 1px solid rgb(68, 68, 68); color: rgb(255, 0, 0); background-color: rgb(204, 204, 204);">赤</div><div class="cell a01 c32 b47" style="width: 60px; float: left; text-align: center; border-bottom: 1px solid rgb(68, 68, 68); color: rgb(0, 255, 0); background-color: rgb(204, 204, 204);">緑</div><div class="cell a01 c33 b47" style="width: 60px; float: left; text-align: center; border-bottom: 1px solid rgb(68, 68, 68); color: r
@ogaty
ogaty / eloquent.md
Last active December 9, 2018 03:32
laravel

紛らわしい2つのget

Laravelには2つのgetがある。
vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.phpと
vendor/laravel/framework/src/Illuminate/Support/Collection.php

$p = Post::where('id', '<', 3)->get();

これはCollectionの配列になる

色問題が出るはlsのLS-COLORS、vimのcolorschemeの2つ
WinのTeraTerm、WLinuxでもMacのiTerm2でもLinuxのTerminatorでも発生
そもそもdi=38;5;27なんていう数値になっているのが悪い。
Ubuntuは01;34だし、悪いのはCentOS7か。
結局サーバー側で対処かソフトで対処か、になる。
けどソフト側は使いづらいのが多い、特にwin
基本自分管理のサーバーはソフトもPCも複数あるので全部LS-COLORSとvimrcでどうにかしたほうがいい
@ogaty
ogaty / serverspec.md
Last active December 22, 2018 06:53
serverspec
require 'spec_helper'

describe package('git') do
  it { should be_installed }
end

describe package('httpd') do
  it { should be_installed }
@ogaty
ogaty / hex-dec.md
Created January 9, 2019 13:36
10進16進

これでもいいんだけど

echo "ibase=16; FF" | bc
echo "ibase=10;obase=16; 255" | bc

これが一番わかりやすい気がする

python -c 'print(hex(255))' # ff
python -c 'print(int(0xff))' # 255
@ogaty
ogaty / newserver.md
Last active January 9, 2019 13:38
new linux server setup

GCP(ubuntu)版

id_rsa.natashのSSH鍵指定で勝手にユーザーまで作ってくれる

ホスト(galaxy)

phpとmariadbはansible-galaxyがイケてない
etckeeperもgalaxyからにしようかな

ansible-galaxy install anxs.build-essential
ansible-galaxy install geerlingguy.composer
ansible-galaxy install geerlingguy.redis
@ogaty
ogaty / goss.yaml
Last active January 15, 2019 11:30
goss centosデフォルトはrubyのバージョンのせいでserverspecが入らないので簡単に入れられるgossのほうが好き
user:
{{ username }}:
exists: true
home: /home/{{ username }}
port:
tcp:20123:
listening: true
package:
git:
installed: true