Skip to content

Instantly share code, notes, and snippets.

View yuyosy's full-sized avatar
💭
I may be slow to respond.

yuyosy yuyosy

💭
I may be slow to respond.
View GitHub Profile
[alias]
logtr = log --graph --all --date=short --pretty=format:'%x09%C(green)%h %C(yellow)%cd %x09%C(cyan bold)%an %C(reset)%x09%C(auto)%s %d'
logtre = log --graph --all --date=short --pretty=format:'%x09%C(green)%h %C(yellow)%cd %x09%C(cyan bold)%an [%ae] %C(reset)%x09%C(auto)%s %d'
logtrec = log --graph --all --date=short --pretty=format:'%x09%C(green)%h %C(yellow)%cd %x09%C(cyan bold)A:%an [%ae]%x09C:%cn [%ce] %C(reset)%x09%C(auto)%s %d'
st = status
sts = status -s
logr = log --grep
gr = grep
co = checkout
cm = commit
書き換え
@UserName@
@E-mail@
過去のコミットのアップデート
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='@UserName@'; GIT_AUTHOR_EMAIL='@E-mail@'; GIT_COMMITTER_NAME='@UserName@'; GIT_COMMITTER_EMAIL='@E-mail@';" HEAD
すべてのバックアップブランチを削除
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
@yuyosy
yuyosy / Main.sublime-menu
Created March 11, 2019 08:09
Sublime Text Menu (Japanese)
[
{
"caption": "File",
"mnemonic": "F",
"id": "file",
"children":
[
{ "command": "new_file", "caption": "新規作成(N)", "mnemonic": "N" },
{ "command": "prompt_open_file", "caption": "ファイルを開く(O)", "mnemonic": "O", "platform": "!OSX" },
# install beautifulsoup4
# install ffmpeg-python
from bs4 import BeautifulSoup
import urllib.request
import ffmpeg
import re
import os
save_path = 'C:/Users/' # 保存先パス
url = 'http://example.com/' # スクレイピングするURL
@yuyosy
yuyosy / matrix.jl
Created September 25, 2018 13:43
Julia <matrix>
m1 = [1 2 3] # 横行列
m2 = [1; 2; 3] # 縦行列 [1, 2, 3]と同等
println("m1 = ", m1)
println("m2 = ", m2)
# 2×2の行列
m3 = [
2 3;
4 5;
]
@yuyosy
yuyosy / math_basic.jl
Created September 25, 2018 13:43
julia <math_basic>
# JuliaではUTF-8エンコードではUnicode文字をサポート
# 対話モード(インタプリタ)でバックスラッシュ(円マーク)に続けて記号名称を入力しTabキーを押すことで変換可能
# π は \pi で変換可能
# 円周率の値は pi でも π でも利用可能
println("pi = $(pi), π = $(π))")
# 数学でよく使う演算
println("|-10| = ", abs(-10)) # 絶対値
println("√9 = ", sqrt(9)) # 平方根
@yuyosy
yuyosy / loop.jl
Created September 25, 2018 13:41
Julia <loop>
for i in 1:5 # i = 1:5と同等 1~5の範囲
print("$i ")
end
println()
for i in 5:-1:1 # 5~1の範囲で-1ずつ変化
print("$i ")
end
println()
@yuyosy
yuyosy / function.jl
Created September 25, 2018 13:41
Julia <function>
# 一般的な記法の関数定義
function f1(a)
return a + 1
end
println("f1 : ", f1(3))
# 括弧をつけない関数f1は、関数オブジェクトとして、他の値と同じように受け渡しが可能
g = f1
println("g : ", g(3))
@yuyosy
yuyosy / if-else.jl
Created September 25, 2018 13:40
Julia <if-else>
x = 2
y = 5
# プログラムでの一般的なの書き方
println(0<x && x<3) # true
println(0<x && x<1) # false
# 数学的な書き方(`&&` の省略)
println(0<x<3) # true
println(0<x<1) # false
@yuyosy
yuyosy / calc.jl
Created September 25, 2018 13:39
Julia <calc>
x = 2
y = 3
println("x = $x, y = $y")
# 変数を含む計算 (*の省略)
println("2x+1 = ", 2x+1)
println("(x+2)x = ", (x+2)x) # xを括弧の前にするのは不可 x(x+2)
# 表記が関数と混在するため
# 除算